Part Number Hot Search : 
SP7072F3 ES005S D10XR R1F3P BZW04P1 MDA918 107M0 AC05P040
Product Description
Full Text Search
 

To Download HD6417709ABT133 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  hitachi superh? risc engine sh7709a hardware manual ade-602-187d rev. 5.0 9/20/01 hitachi, ltd.
cautions 1. hitachi neither warrants nor grants licenses of any rights of hitachis or any third partys patent, copyright, trademark, or other intellectual property rights for information contained in this document. hitachi bears no responsibility for problems that may arise with third partys rights, including intellectual property rights, in connection with use of the information contained in this document. 2. products and product specifications may be subject to change without notice. confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. hitachi makes every attempt to ensure that its products are of high quality and reliability. however, contact hitachis sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. design your application so that the product is used within the ranges guaranteed by hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the hitachi product. 5. this product is not designed to be radiation resistant. 6. no one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from hitachi. 7. contact hitachis sales office for any questions regarding this document or hitachi semiconductor products.
preface the sh7709a is a microprocessor that integrates peripheral functions necessary for system configuration with a 32-bit internal architecture sh3-dsp cpu as its core. the sh7729r's on-chip peripheral functions include a cache memory, an interrupt controller, timers, three serial communication interfaces, a real time clock (rtc), memory management unit (mmu), a user break controller (ubc), a bus state controller (bsc), and i/o ports, making it ideal for use as a microcomputer in electronic devices that require high speed together with low power consumption. intended readership: this manual is intended for users undertaking the design of an application system using the sh7709a. readers using this manual require a basic knowledge of electrical circuits, logic circuits, and microcomputers. purpose: the purpose of this manual is to give users an understanding of the hardware functions and electrical characteristics of the sh7709a. details of execution instructions can be found in the sh-3, sh-3e, sh3-dsp programming manual, which should be read in conjunction with the present manual. using this manual: ? for an overall understanding of the sh7709a's functions follow the table of contents.this manual is broadly divided into sections on the cpu, system control functions, peripheral functions, and electrical characteristics. ? for a detailed understanding of cpu functions refer to the separate publication sh-3, sh-3e, sh3-dsp programming manual. note on bit notation: bits are shown in high-to-low order from left to right. related material: the latest information is available at our web site. please make sure that you have the most up-to-date information available. (http://www.hitachisemiconductor.com/)
user's manuals on the sh7709a: manual title ade no. sh7709a hardware manual this manual sh-3, sh-3e, sh-3dsp programming manual ade-602-096 users manuals for development tools: manual title ade no. c/c++ complier, assembler, optimized linkage editor user's manual ade-702-246 simulator debugger users manual ade-702-186 hitachi embedded workshop users manual ade-702-201
list of items revised or added for this version section page item description 1.3.1 pin assignment 8 figure1.3 pin assignment figure location changed 1.3.2 pin function 12 table1.3 sh7709a pin function write strobe (pcmcia) added to description of pin no. 90 14 note 6 added for pin name of pin no. 127 17 pin nos. 206, 207 description changed, note 6 description added 2.4.1 instruction set 44 table2.8 logic operation instructions note * added and note description added for tas.b @rn 3.1.3 sh7709a mmu 60 virtual address map description added 4.2.2 exception processing vector addresses 89 table4.2 exception event vectors exception event reserved instruction code exception changed to general illegal instruction exception 4.2.3 acceptance of exceptions 90 4.2.3 acceptance of exceptions description changed 4.2.4 exception codes 92 4.2.4 exception codes description changed table4.3 exception codes description changed and expanded 4.5.1 reset 96 4.5.1 reset ? power-on reset, ? manual reset, ? h-udi reset 1111 changed to b'1111 4.5.2 general exceptions 97_100 tlb miss exception_user break point trap description changed 4.5.3 interrupts 100,101 nmi_h-udi interrupt description changed 4.6 captions 102 return from exception processing_initial register values after reset description changed and expanded 5.2 register description 107 5.2.1 cache control register(ccr) description changed 108 figure5.2 ccr register configuration figure and description changed 5.3.3 prefetch operations 112 5.3.3 prefetch operations added
section page item description 6.2.2 irq interrupt 121 6.2.2 irq interrupt description added 8.1.1 power-down modes 182 table8.1 power-down modes note 4 added for module standby cpu and description changed note 4 description added 8.4.2 canceling standby mode 188 canceling with an interrupt description changed and expanded 9.9 wdt registers 216 9.9.1 watchdog timer counter (wtcnt) description changed and note added 9.9.2 watchdog timer control/status register (wtcsr) note added 9.10.2 changing the frequency 219 9.10.2 changing the frequency description changed and (6) added 10.1.6 pcmcia support 234 table10.6 pcmcia support interface note * added for wp of pin 33 note description added 10.2.6 individual memory control register (mcr) 249 10.2.6 individual memory control register (mcr) description added for bits 15 and 14ras precharge time, table changed and note added 10.3.8 waits bitween access cycles 346 figure10.53 waits between access cycles cross-hatching added for twait for a25 to a0 11.3.4 dma transfer types 385 figure11.13 example of dma transfer timing in single address mode title description changed 11.4 compare match timer (cmt) 401_407 11.4 compare match timer (cmt) throughout section 11.4, 0 omitted from end of cmcsr0, cmcor0, cmcnt0 14.3.2 operation in asychronous mode 486 figure14.10 sample flowchart for receiving serial data figure description changed section 16 serial communication interface with fifo (scif) 536_573 section 16 serial communication interface with fifo (scif) 2 added to end of scrsr, scfrdr, sctsr, scftdr, scsmr, scscr, scssr, scbrr, scfcr, scfdr, rxd, txd, sck, rts, cts
section page item description 18.3 register descriptions 593 18.3.4 port d control register (pdcr) reserved changed to reserved (setting prohibited) 595 18.3.6 port f control register (pfcr) 596 18.3.7 port g control register (pgcr) 597_598 18.3.8 port h control register (phcr) 600 18.3.11 port l control register (plcr) 601 18.3.12 sc port control register (scpcr) 20.1.4 register configuration 632 table 20.2 a/d converter registers access size changed and notes 3 and 4 added 20.3 a/d data register access size 637 20.3 a/d data register access size 20.3 added 22.4.3 h-udi reset 669 22.4.3 h-udi reset description added 23.2 dc characterisrtics 676_678 table23.2 dc characteristics (except da1, da0) added to all output pins for output high voltage and output low voltage note 6 added 23.3.3 ac bus timing 692 table 23.7 bus timing cke delay time added 23.3.7 synchronous dram timing 721 figure 23.44 synchronous dram burst read bus cycle (ras down,same row address,cas latency = 2) tnop cycle deleted 727 figure 23.50 synchronous dram auto-refresh timing (tras=1,tpc=1) csn level in 2nd cycle from start changed from high level to low level one trrw cycle inserted 728 figure 23.51 sunchronous dram self-refresh cycle (tpc=0) csn level in 2nd cycle from start changed from high level to low level
section page item description appendix a pin functions 784_785 table a.12 pin states (pcmcia/big endian) note 3 added for ce2a , ce2b note 3 description added appendix b memory- mapped control registers 786_787 table b.1 memory- mapped control registers basra, basrb, bamra, bamrb, brcr size and access cycles changed sdmr address changed ? sdsr, sddr/sddrh, sddrl, sdar, sdare description deleted
i contents section 1overview and pin functions ........................................................................ 1 1.1 sh7709a features ........................................................................................................... .. 1 1.2 block diagram .............................................................................................................. ..... 6 1.3 pin description............................................................................................................ ....... 7 1.3.1 pin assignment ..................................................................................................... 7 1.3.2 pin function.......................................................................................................... 9 section 2 cpu ..................................................................................................................... 19 2.1 register configuration ..................................................................................................... .. 19 2.1.1 privileged mode and banks.................................................................................. 19 2.1.2 general registers.................................................................................................. 22 2.1.3 system registers................................................................................................... 23 2.1.4 control registers .................................................................................................. 23 2.2 data formats............................................................................................................... ....... 25 2.2.1 data format in registers ...................................................................................... 25 2.2.2 data format in memory........................................................................................ 25 2.3 instruction features....................................................................................................... ..... 26 2.3.1 execution environment ........................................................................................ 26 2.3.2 addressing modes ................................................................................................ 28 2.3.3 instruction formats ............................................................................................... 32 2.4 instruction set ............................................................................................................ ........ 35 2.4.1 instruction set classified by function.................................................................. 35 2.4.2 instruction code map ........................................................................................... 51 2.5 processor states and processor modes .............................................................................. 54 2.5.1 processor states .................................................................................................... 54 2.5.2 processor modes ................................................................................................... 55 section 3 memory management unit (mmu) .......................................................... 57 3.1 overview................................................................................................................... ......... 57 3.1.1 features ................................................................................................................. 57 3.1.2 role of mmu........................................................................................................ 57 3.1.3 sh7709a mmu.................................................................................................... 60 3.1.4 register configuration.......................................................................................... 63 3.2 register description....................................................................................................... .... 64 3.3 tlb functions .............................................................................................................. ..... 66 3.3.1 configuration of the tlb ..................................................................................... 66 3.3.2 tlb indexing........................................................................................................ 68 3.3.3 tlb address comparison .................................................................................... 69 3.3.4 page management information............................................................................. 71
ii 3.4 mmu functions .............................................................................................................. ... 72 3.4.1 mmu hardware management.............................................................................. 72 3.4.2 mmu software management ............................................................................... 72 3.4.3 mmu instruction (ldtlb).................................................................................. 73 3.4.4 avoiding synonym problems ............................................................................... 75 3.5 mmu exceptions ............................................................................................................. .. 7 7 3.5.1 tlb miss exception ............................................................................................. 77 3.5.2 tlb protection violation exception .................................................................... 78 3.5.3 tlb invalid exception ......................................................................................... 79 3.5.4 initial page write exception................................................................................. 80 3.5.5 processing flow in event of mmu exception (same processing flow for address error) .......................................................... 82 3.6 memory-mapped tlb ....................................................................................................... 84 3.6.1 address array ....................................................................................................... 84 3.6.2 data array ............................................................................................................ 84 3.6.3 usage examples.................................................................................................... 86 3.7 usage note ................................................................................................................. ........ 86 section 4 exception processing ..................................................................................... 87 4.1 overview................................................................................................................... ......... 87 4.1.1 features ................................................................................................................. 87 4.1.2 register configuration.......................................................................................... 87 4.2 exception processing function.......................................................................................... 87 4.2.1 exception processing flow................................................................................... 87 4.2.2 exception processing vector addresses .............................................................. 88 4.2.3 acceptance of exceptions..................................................................................... 90 4.2.4 exception codes ................................................................................................... 92 4.2.5 exception request masks ..................................................................................... 93 4.2.6 returning from exception handling .................................................................... 93 4.3 register description....................................................................................................... .... 94 4.4 exception handler operation ............................................................................................ 94 4.4.1 reset.................................................................................................................... .. 94 4.4.2 interrupts ............................................................................................................... 95 4.4.3 general exceptions ............................................................................................... 95 4.5 individual exception operations ....................................................................................... 96 4.5.1 resets................................................................................................................... .96 4.5.2 general exceptions ............................................................................................... 97 4.5.3 interrupts ............................................................................................................... 100 4.6 cautions ................................................................................................................... .......... 102 section 5 cache .................................................................................................................. 105 5.1 overview................................................................................................................... ......... 105 5.1.1 features ................................................................................................................. 105
iii 5.1.2 cache structure..................................................................................................... 105 5.1.3 register configuration.......................................................................................... 107 5.2 register description....................................................................................................... .... 107 5.2.1 cache control register (ccr) ............................................................................. 107 5.2.2 cache control register 2 (ccr2) ........................................................................ 108 5.3 cache operation............................................................................................................ ..... 110 5.3.1 searching the cache.............................................................................................. 110 5.3.2 read access.......................................................................................................... 112 5.3.3 prefetch operations .............................................................................................. 112 5.3.4 write access ......................................................................................................... 112 5.3.5 write-back buffer ................................................................................................ 112 5.3.6 coherency of cache and external memory.......................................................... 113 5.4 memory-mapped cache .................................................................................................... 113 5.4.1 address array ....................................................................................................... 113 5.4.2 data array ............................................................................................................ 114 5.5 usage examples ............................................................................................................. .... 116 5.5.1 invalidating specific entries................................................................................. 116 5.5.2 reading the data of a specific entry.................................................................... 116 5.6 usage note ................................................................................................................. ........ 116 5.6.1 cache lock function............................................................................................ 116 section 6 interrupt controller (intc) ......................................................................... 117 6.1 overview................................................................................................................... ......... 117 6.1.1 features ................................................................................................................. 117 6.1.2 block diagram...................................................................................................... 118 6.1.3 pin configuration.................................................................................................. 119 6.1.4 register configuration.......................................................................................... 120 6.2 interrupt sources.......................................................................................................... ...... 121 6.2.1 nmi interrupts ...................................................................................................... 121 6.2.2 irq interrupt ........................................................................................................ 121 6.2.3 irl interrupts........................................................................................................ 122 6.2.4 pint interrupt ...................................................................................................... 124 6.2.5 on-chip peripheral module interrupts ................................................................. 124 6.2.6 interrupt exception processing and priority ......................................................... 125 6.3 intc registers ............................................................................................................. ..... 131 6.3.1 interrupt priority registers a to e (ipraCipre) ................................................ 131 6.3.2 interrupt control register 0 (icr0)...................................................................... 132 6.3.3 interrupt control register 1 (icr1)...................................................................... 133 6.3.4 interrupt control register 2 (icr2)...................................................................... 136 6.3.5 pint interrupt enable register (pinter) .......................................................... 137 6.3.6 interrupt request register 0 (irr0) ..................................................................... 138 6.3.7 interrupt request register 1 (irr1) ..................................................................... 140 6.3.8 interrupt request register 2 (irr2) ..................................................................... 141
iv 6.4 intc operation ............................................................................................................. .... 143 6.4.1 interrupt sequence ................................................................................................ 143 6.4.2 multiple interrupts ................................................................................................ 145 6.5 interrupt response time.................................................................................................... 145 section 7 user break controller .................................................................................... 149 7.1 overview................................................................................................................... ......... 149 7.1.1 features ................................................................................................................. 149 7.1.2 block diagram...................................................................................................... 151 7.1.3 register configuration.......................................................................................... 152 7.2 register descriptions ...................................................................................................... ... 153 7.2.1 break address register a (bara)...................................................................... 153 7.2.2 break address mask register a (bamra) ........................................................ 154 7.2.3 break bus cycle register a (bbra) .................................................................. 155 7.2.4 break address register b (barb) ...................................................................... 157 7.2.5 break address mask register b (bamrb)......................................................... 158 7.2.6 break data register b (bdrb)............................................................................ 159 7.2.7 break data mask register b (bdmrb) .............................................................. 160 7.2.8 break bus cycle register b (bbrb) ................................................................... 161 7.2.9 break control register (brcr) ........................................................................... 163 7.2.10 execution times break register (betr) ............................................................ 167 7.2.11 branch source register (brsr) .......................................................................... 168 7.2.12 branch destination register (brdr) .................................................................. 169 7.2.13 break asid register a (basra) ....................................................................... 170 7.2.14 break asid register b (basrb)........................................................................ 170 7.3 operation description...................................................................................................... .. 171 7.3.1 flow of the user break operation........................................................................ 171 7.3.2 break on instruction fetch cycle ......................................................................... 172 7.3.3 break by data access cycle................................................................................. 172 7.3.4 sequential break ................................................................................................... 173 7.3.5 value of saved program counter ......................................................................... 173 7.3.6 pc trace................................................................................................................ 1 74 7.3.7 usage examples.................................................................................................... 175 7.3.8 notes .................................................................................................................... .179 section 8 power-down modes ...................................................................................... 181 8.1 overview................................................................................................................... ......... 181 8.1.1 power-down modes ............................................................................................. 181 8.1.2 pin configuration.................................................................................................. 182 8.1.3 register configuration.......................................................................................... 183 8.2 register description....................................................................................................... .... 183 8.2.1 standby control register (stbcr)...................................................................... 183 8.2.2 standby control register 2 (stbcr2) ................................................................ 184
v 8.3 sleep mode ................................................................................................................. ....... 186 8.3.1 transition to sleep mode...................................................................................... 186 8.3.2 canceling sleep mode.......................................................................................... 186 8.4 standby mode ............................................................................................................... ..... 187 8.4.1 transition to standby mode.................................................................................. 187 8.4.2 canceling standby mode...................................................................................... 188 8.4.3 clock pause function ........................................................................................... 189 8.5 module standby function.................................................................................................. 19 0 8.5.1 transition to module standby function ............................................................... 190 8.5.2 clearing the module standby function................................................................ 190 8.6 timing of status pin changes ...................................................................................... 191 8.6.1 timing for resets.................................................................................................. 191 8.6.2 timing for canceling standbys ............................................................................ 193 8.6.3 timing for canceling sleep mode........................................................................ 194 8.7 hardware standby function .............................................................................................. 196 8.7.1 transition to hardware standby mode................................................................. 196 8.7.2 canceling hardware standby mode ..................................................................... 197 8.7.3 hardware standby mode timing.......................................................................... 197 section 9 on-chip oscillation circuits ....................................................................... 199 9.1 overview................................................................................................................... ......... 199 9.1.1 features ................................................................................................................. 199 9.2 overview of the cpg ........................................................................................................ . 200 9.2.1 cpg block diagram ............................................................................................. 200 9.2.2 cpg pin configuration ......................................................................................... 202 9.2.3 cpg register configuration ................................................................................. 202 9.3 clock operating modes ..................................................................................................... 2 03 9.4 register descriptions ...................................................................................................... ... 208 9.4.1 frequency control register (frqcr) ................................................................. 208 9.5 changing the frequency .................................................................................................... 2 11 9.5.1 changing the multiplication rate......................................................................... 211 9.5.2 note on changing the multiplication rate ........................................................... 211 9.5.3 changing the division ratio ................................................................................ 212 9.6 pll standby function ....................................................................................................... 212 9.6.1 overview of the pll standby function ............................................................... 212 9.6.2 usage .................................................................................................................... 212 9.7 controlling clock output .................................................................................................. 2 14 9.7.1 clock modes 0 to 2 ............................................................................................... 214 9.7.2 clock modes 3, 4.................................................................................................. 214 9.8 overview of the wdt........................................................................................................ 215 9.8.1 block diagram of the wdt.................................................................................. 215 9.8.2 register configurations ........................................................................................ 215 9.9 wdt registers.............................................................................................................. ..... 216
vi 9.9.1 watchdog timer counter (wtcnt).................................................................... 216 9.9.2 watchdog timer control/status register (wtcsr) ........................................... 216 9.9.3 notes on register access...................................................................................... 218 9.10 using the wdt ............................................................................................................. ..... 219 9.10.1 canceling standbys .............................................................................................. 219 9.10.2 changing the frequency ....................................................................................... 219 9.10.3 using watchdog timer mode .............................................................................. 220 9.10.4 using interval timer mode .................................................................................. 220 9.11 notes on board design ..................................................................................................... . 221 section 10 bus state controller (bsc) .......................................................................... 223 10.1 overview.................................................................................................................. .......... 223 10.1.1 features ................................................................................................................ . 223 10.1.2 block diagram...................................................................................................... 225 10.1.3 pin configuration.................................................................................................. 226 10.1.4 register configuration.......................................................................................... 228 10.1.5 area overview...................................................................................................... 229 10.1.6 pcmcia support ................................................................................................. 232 10.2 bsc registers ............................................................................................................. ....... 236 10.2.1 bus control register 1 (bcr1)............................................................................ 236 10.2.2 bus control register 2 (bcr2)............................................................................ 240 10.2.3 bus control register 3 (bcr3)............................................................................ 241 10.2.4 wait state control register 1 (wcr1) ................................................................ 244 10.2.5 wait state control register 2 (wcr2) ................................................................ 245 10.2.6 individual memory control register (mcr) ....................................................... 249 10.2.7 dram control register (dcr) ........................................................................... 254 10.2.8 pcmcia control register (pcr) ........................................................................ 256 10.2.9 synchronous dram mode register (sdmr) ..................................................... 260 10.2.10 refresh timer control/status register (rtcsr) ................................................ 261 10.2.11 refresh timer counter (rtcnt) ........................................................................ 263 10.2.12 refresh time constant register (rtcor).......................................................... 264 10.2.13 refresh count register (rfcr) ........................................................................... 264 10.2.14 cautions on accessing refresh control related registers.................................. 265 10.2.15 mcs0 control register (mcscr0) ..................................................................... 266 10.2.16 mcs1 control register (mcscr1) ..................................................................... 267 10.2.17 mcs2 control register (mcscr2) ..................................................................... 267 10.2.18 mcs3 control register (mcscr3) ..................................................................... 267 10.2.19 mcs4 control register (mcscr4) ..................................................................... 267 10.2.20 mcs5 control register (mcscr5) ..................................................................... 267 10.2.21 mcs6 control register (mcscr6) ..................................................................... 267 10.2.22 mcs7 control register (mcscr7) ..................................................................... 267 10.3 bsc operation ............................................................................................................. ...... 268 10.3.1 endian/access size and data alignment ............................................................. 268
vii 10.3.2 description of areas ............................................................................................. 274 10.3.3 basic interface ...................................................................................................... 277 10.3.4 dram interface ................................................................................................... 285 10.3.5 synchronous dram interface ............................................................................. 302 10.3.6 burst rom interface ............................................................................................ 330 10.3.7 pcmcia interface................................................................................................ 333 10.3.8 waits between access cycles .............................................................................. 345 10.3.9 bus arbitration...................................................................................................... 346 10.3.10 bus pull-up .......................................................................................................... 34 7 10.3.11 mcs[0] to mcs[7] pin control ........................................................................... 349 section 11 direct memory access controller (dmac) .......................................... 353 11.1 overview.................................................................................................................. .......... 353 11.1.1 features ................................................................................................................ . 353 11.1.2 block diagram...................................................................................................... 355 11.1.3 pin configuration.................................................................................................. 356 11.1.4 register configuration.......................................................................................... 356 11.2 register descriptions ..................................................................................................... .... 358 11.2.1 dma source address registers 0C3 (sar0Csar3)........................................... 358 11.2.2 dma destination address registers 0C3 (dar0Cdar3) .................................. 359 11.2.3 dma transfer count registers 0C3 (dmatcr0Cdmatcr3) ......................... 360 11.2.4 dma channel control registers 0C3 (chcr0Cchcr3) ................................... 361 11.2.5 dma operation register (dmaor) ................................................................... 367 11.3 operation................................................................................................................. ........... 369 11.3.1 dma transfer flow ............................................................................................. 369 11.3.2 dma transfer requests ....................................................................................... 371 11.3.3 channel priority.................................................................................................... 373 11.3.4 dma transfer types............................................................................................ 376 11.3.5 number of bus cycle states and dreq pin sampling timing........................... 388 11.3.6 source address reload function.......................................................................... 397 11.3.7 dma transfer ending conditions........................................................................ 399 11.4 compare match timer (cmt)........................................................................................... 401 11.4.1 overview............................................................................................................... 4 01 11.4.2 register descriptions............................................................................................ 402 11.4.3 operation .............................................................................................................. 4 05 11.4.4 compare match .................................................................................................... 406 11.5 examples of use ........................................................................................................... ..... 408 11.5.1 example of dma transfer between on-chip irda and external memory ........ 408 11.5.2 example of dma transfer between ad0 and external memory (address reload on) ............................................................................................. 409 11.5.3 example of dma transfer between external memory and scif transmitter (indirect address on) ............................................................................................ 410 11.6 cautions .................................................................................................................. ........... 411
viii section 12 timer (tmu) .................................................................................................... 413 12.1 overview.................................................................................................................. .......... 413 12.1.1 features ................................................................................................................ .413 12.1.2 block diagram...................................................................................................... 414 12.1.3 pin configuration.................................................................................................. 415 12.1.4 register configuration.......................................................................................... 415 12.2 tmu registers ............................................................................................................. ...... 416 12.2.1 timer output control register (tocr)............................................................... 416 12.2.2 timer start register (tstr) ................................................................................ 416 12.2.3 timer control register (tcr).............................................................................. 417 12.2.4 timer constant register (tcor)......................................................................... 420 12.2.5 timer counters (tcnt) ....................................................................................... 421 12.2.6 input capture register (tcpr2) .......................................................................... 422 12.3 tmu operation............................................................................................................. ..... 423 12.3.1 overview............................................................................................................... 4 23 12.3.2 basic functions..................................................................................................... 423 12.4 interrupts ................................................................................................................ ............ 427 12.4.1 status flag set timing.......................................................................................... 427 12.4.2 status flag clear timing ...................................................................................... 428 12.4.3 interrupt sources and priorities ............................................................................ 428 12.5 usage notes ............................................................................................................... ........ 429 12.5.1 writing to registers.............................................................................................. 429 12.5.2 reading registers ................................................................................................. 429 section 13 realtime clock (rtc) ................................................................................... 431 13.1 overview.................................................................................................................. .......... 431 13.1.1 features ................................................................................................................ . 431 13.1.2 block diagram...................................................................................................... 431 13.1.3 pin configuration.................................................................................................. 433 13.1.4 rtc register configuration ................................................................................. 434 13.2 rtc registers............................................................................................................. ....... 435 13.2.1 64-hz counter (r64cnt) .................................................................................... 435 13.2.2 second counter (rseccnt) ............................................................................... 435 13.2.3 minute counter (rmincnt) ............................................................................... 436 13.2.4 hour counter (rhrcnt) .................................................................................... 436 13.2.5 day of the week counter (rwkcnt) ................................................................ 437 13.2.6 date counter (rdaycnt).................................................................................. 438 13.2.7 month counter (rmoncnt) .............................................................................. 438 13.2.8 year counter (ryrcnt) ..................................................................................... 439 13.2.9 second alarm register (rsecar)...................................................................... 439 13.2.10 minute alarm register (rminar)...................................................................... 440 13.2.11 hour alarm register (rhrar) ........................................................................... 440 13.2.12 day of the week alarm register (rwkar) ....................................................... 441
ix 13.2.13 date alarm register (rdayar)......................................................................... 442 13.2.14 month alarm register (rmonar) ..................................................................... 442 13.2.15 rtc control register 1 (rcr1) .......................................................................... 443 13.2.16 rtc control register 2 (rcr2) .......................................................................... 444 13.3 rtc operation ............................................................................................................. ...... 446 13.3.1 initial settings of registers after power-on ......................................................... 446 13.3.2 setting the time.................................................................................................... 446 13.3.3 reading the time.................................................................................................. 447 13.3.4 alarm function ..................................................................................................... 448 13.3.5 crystal oscillator circuit...................................................................................... 449 13.4 usage notes ............................................................................................................... ........ 450 13.4.1 register writing during rtc count..................................................................... 450 13.4.2 use of realtime clock (rtc) periodic interrupts................................................ 450 section 14 serial communication interface (sci) ..................................................... 451 14.1 overview.................................................................................................................. .......... 451 14.1.1 features ................................................................................................................ . 451 14.1.2 block diagram...................................................................................................... 452 14.1.3 pin configuration.................................................................................................. 455 14.1.4 register configuration.......................................................................................... 456 14.2 register descriptions ..................................................................................................... .... 456 14.2.1 receive shift register (scrsr) .......................................................................... 456 14.2.2 receive data register (scrdr).......................................................................... 457 14.2.3 transmit shift register (sctsr) ......................................................................... 457 14.2.4 transmit data register (sctdr) ........................................................................ 457 14.2.5 serial mode register (scsmr)............................................................................ 458 14.2.6 serial control register (scscr).......................................................................... 460 14.2.7 serial status register (scssr) ............................................................................ 463 14.2.8 sc port control register (scpcr)/sc port data register (scpdr) ................. 467 14.2.9 bit rate register (scbrr) .................................................................................. 469 14.3 operation................................................................................................................. ........... 477 14.3.1 overview............................................................................................................... 4 77 14.3.2 operation in asynchronous mode........................................................................ 479 14.3.3 multiprocessor communication............................................................................ 489 14.3.4 clock synchronous operation.............................................................................. 498 14.4 sci interrupt sources..................................................................................................... .... 508 14.5 notes on use .............................................................................................................. ........ 509 section 15 smart card interface ...................................................................................... 513 15.1 overview.................................................................................................................. .......... 513 15.1.1 features ................................................................................................................ .513 15.1.2 block diagram...................................................................................................... 514 15.1.3 pin configuration.................................................................................................. 515
x 15.1.4 register configuration.......................................................................................... 515 15.2 register descriptions ..................................................................................................... .... 516 15.2.1 smart card mode register (scscmr)................................................................ 516 15.2.2 serial status register (scssr) ............................................................................ 517 15.3 operation................................................................................................................. ........... 518 15.3.1 overview............................................................................................................... 5 18 15.3.2 pin connections .................................................................................................... 519 15.3.3 data format .......................................................................................................... 520 15.3.4 register settings ................................................................................................... 521 15.3.5 clock ................................................................................................................... .. 522 15.3.6 data transmission and reception ........................................................................ 525 15.4 usage notes ............................................................................................................... ........ 531 15.4.1 receive data timing and receive margin in asynchronous mode .................... 531 15.4.2 retransmission (receive and transmit modes) ................................................... 533 15.4.3 block transfer mode support .............................................................................. 534 section 16 serial communication interface with fifo (scif) ............................. 535 16.1 overview.................................................................................................................. .......... 535 16.1.1 features ................................................................................................................ . 535 16.1.2 block diagram...................................................................................................... 536 16.1.3 pin configuration.................................................................................................. 539 16.1.4 register configuration.......................................................................................... 540 16.2 register descriptions ..................................................................................................... .... 540 16.2.1 receive shift register (scrsr2) ........................................................................ 540 16.2.2 receive fifo data register (scfrdr2)............................................................ 541 16.2.3 transmit shift register (sctsr2) ....................................................................... 541 16.2.4 transmit fifo data register (scftdr2)........................................................... 541 16.2.5 serial mode register (scsmr2).......................................................................... 542 16.2.6 serial control register (scscr2)........................................................................ 544 16.2.7 serial status register (scssr2) .......................................................................... 546 16.2.8 bit rate register (scbrr2) ................................................................................ 551 16.2.9 fifo control register (scfcr2) ........................................................................ 558 16.2.10 fifo data count set register (scfdr2)............................................................ 560 16.3 operation................................................................................................................. ........... 561 16.3.1 overview............................................................................................................... 5 61 16.3.2 serial operation .................................................................................................... 562 16.4 scif interrupts........................................................................................................... ........ 571 16.5 notes on use .............................................................................................................. ........ 572 section 17 irda .................................................................................................................... 575 17.1 overview.................................................................................................................. .......... 575 17.1.1 features ................................................................................................................ . 575 17.1.2 block diagram...................................................................................................... 576
xi 17.1.3 pin configuration.................................................................................................. 579 17.1.4 register configuration.......................................................................................... 580 17.2 register description...................................................................................................... ..... 580 17.2.1 serial mode register (scsmr)............................................................................ 581 17.3 operation description..................................................................................................... ... 582 17.3.1 overview............................................................................................................... 5 82 17.3.2 transmit................................................................................................................ 583 17.3.3 receive................................................................................................................. . 583 section 18 pin function controller ................................................................................. 585 18.1 overview.................................................................................................................. .......... 585 18.2 register configuration .................................................................................................... ... 589 18.3 register descriptions ..................................................................................................... .... 590 18.3.1 port a control register (pacr) .......................................................................... 590 18.3.2 port b control register (pbcr)........................................................................... 591 18.3.3 port c control register (pccr)........................................................................... 592 18.3.4 port d control register (pdcr) .......................................................................... 593 18.3.5 port e control register (pecr) ........................................................................... 594 18.3.6 port f control register (pfcr)............................................................................ 595 18.3.7 port g control register (pgcr) .......................................................................... 596 18.3.8 port h control register (phcr) .......................................................................... 597 18.3.9 port j control register (pjcr) ............................................................................. 598 18.3.10 port k control register (pkcr) .......................................................................... 599 18.3.11 port l control register (plcr) ........................................................................... 600 18.3.12 sc port control register (scpcr) ...................................................................... 601 section 19 i/o ports ............................................................................................................. 605 19.1 overview.................................................................................................................. .......... 605 19.2 port a .................................................................................................................... ............. 605 19.2.1 register descriptions............................................................................................ 605 19.2.2 port a data register (padr)............................................................................... 606 19.3 port b .................................................................................................................... ............. 607 19.3.1 register descriptions............................................................................................ 607 19.3.2 port b data register (pbdr) ............................................................................... 608 19.4 port c .................................................................................................................... ............. 609 19.4.1 register descriptions............................................................................................ 609 19.4.2 port c data register (pcdr) ............................................................................... 610 19.5 port d .................................................................................................................... ............. 611 19.5.1 register descriptions............................................................................................ 611 19.5.2 port d data register (pddr)............................................................................... 612 19.6 port e .................................................................................................................... ............. 613 19.6.1 register descriptions............................................................................................ 613 19.6.2 port e data register (pedr)................................................................................ 614
xii 19.7 port f.................................................................................................................... .............. 615 19.7.1 register descriptions............................................................................................ 615 19.7.2 port f data register (pfdr)................................................................................ 616 19.8 port g .................................................................................................................... ............. 617 19.8.1 register descriptions............................................................................................ 617 19.8.2 port g data register (pgdr)............................................................................... 618 19.9 port h .................................................................................................................... ............. 619 19.9.1 register descriptions............................................................................................ 619 19.9.2 port h data register (phdr)............................................................................... 620 19.10 port j ................................................................................................................... ............... 621 19.10.1 register descriptions............................................................................................ 621 19.10.2 port j data register (pjdr) ................................................................................. 621 19.11 port k ................................................................................................................... .............. 623 19.11.1 register descriptions............................................................................................ 623 19.11.2 port k data register (pkdr)............................................................................... 624 19.12 port l................................................................................................................... ............... 625 19.12.1 register descriptions............................................................................................ 625 19.12.2 port l data register (pldr)................................................................................ 626 19.13 sc port .................................................................................................................. ............. 627 19.13.1 register descriptions............................................................................................ 627 19.13.2 port sc data register (scpdr)........................................................................... 627 section 20 a/d converter .................................................................................................. 629 20.1 overview.................................................................................................................. .......... 629 20.1.1 features ................................................................................................................ . 629 20.1.2 block diagram...................................................................................................... 630 20.1.3 input pins .............................................................................................................. 631 20.1.4 register configuration.......................................................................................... 632 20.2 register descriptions ..................................................................................................... .... 633 20.2.1 a/d data registers a to d (addra to addrd).............................................. 633 20.2.2 a/d control/status register (adcsr) ................................................................ 634 20.2.3 a/d control register (adcr) ............................................................................. 636 20.3 a/d data register access size.......................................................................................... 637 20.3.1word access ......................................................................................................... 637 20.3.2 longword access.................................................................................................. 637 20.4 bus master interface ...................................................................................................... .... 638 20.5 operation................................................................................................................. ........... 639 20.5.1 single mode (multi = 0) ................................................................................... 639 20.5.2 multi mode (multi = 1)..................................................................................... 641 20.5.3 scan mode (multi = 1, scn = 1)...................................................................... 643 20.5.4 input sampling and a/d conversion time .......................................................... 645 20.5.5 external trigger input timing.............................................................................. 646 20.6 interrupts ................................................................................................................ ............ 646 20.7 definitions of a/d conversion accuracy.......................................................................... 647
xiii 20.8 a/d converter usage notes .............................................................................................. 648 20.8.1 setting analog input voltage ............................................................................... 648 20.8.2 processing of analog input pins........................................................................... 648 20.8.3 access size and read data................................................................................... 648 section 21d/a converter .................................................................................................. 651 21.1 overview.................................................................................................................. .......... 651 21.1.1 features ................................................................................................................ . 651 21.1.2 block diagram...................................................................................................... 651 21.1.3 i/o pins ................................................................................................................ . 652 21.1.4 register configuration.......................................................................................... 652 21.2 register descriptions ..................................................................................................... .... 653 21.2.1 d/a data registers 0 and 1 (dadr0/1) .............................................................. 653 21.2.2 d/a control register (dacr) ............................................................................. 653 21.3 operation................................................................................................................. ........... 655 section 22 hitachi user-debugging interface (h-udi) ........................................... 657 22.1 overview.................................................................................................................. .......... 657 22.2 hitachi user debugging interface (h-udi) ...................................................................... 657 22.2.1 pin description...................................................................................................... 657 22.2.2 block diagram...................................................................................................... 658 22.3 register descriptions ..................................................................................................... .... 658 22.3.1 bypass register (sdbpr) .................................................................................... 659 22.3.2 instruction register (sdir).................................................................................. 659 22.3.3 boundary scan register (sdbsr) ....................................................................... 660 22.4 h-udi operations.......................................................................................................... .... 667 22.4.1 tap controller...................................................................................................... 667 22.4.2 reset configuration .............................................................................................. 668 22.4.3 h-udi reset ......................................................................................................... 669 22.4.4 h-udi interrupt .................................................................................................... 669 22.4.5 bypass .................................................................................................................. . 669 22.4.6 using h-udi to recover from sleep mode ......................................................... 669 22.5 boundary scan ............................................................................................................. ...... 670 22.5.1 supported instructions .......................................................................................... 670 22.5.2 notes on use ......................................................................................................... 671 22.6 notes on use .............................................................................................................. ........ 672 22.7 advanced user debugger (aud)...................................................................................... 672 section 23 electrical characteristics .............................................................................. 673 23.1 absolute maximum ratings .............................................................................................. 673 23.2 dc characteristics ........................................................................................................ ..... 675 23.3 ac characteristics ........................................................................................................ ..... 678 23.3.1 clock timing ........................................................................................................ 679
xiv 23.3.2 control signal timing .......................................................................................... 688 23.3.3 ac bus timing ..................................................................................................... 691 23.3.4 basic timing......................................................................................................... 693 23.3.5 burst rom timing ............................................................................................... 697 23.3.6 dram timing...................................................................................................... 700 23.3.7 synchronous dram timing................................................................................ 712 23.3.8 pcmcia timing .................................................................................................. 730 23.3.9 peripheral module signal timing ........................................................................ 737 23.3.10 h-udi-related pin timing .................................................................................. 740 23.3.11 a/d converter timing.......................................................................................... 742 23.3.12 ac characteristics measurement conditions....................................................... 744 23.3.13 delay time variation due to load capacitance.................................................. 745 23.4 a/d converter characteristics ........................................................................................... 74 6 23.5 d/a converter characteristics ........................................................................................... 74 6 appendix a pin functions ................................................................................................ 747 a.1 pin states................................................................................................................. ........... 747 a.2 pin specifications......................................................................................................... ...... 751 a.3 processing of unused pins ................................................................................................. 7 55 a.4 pin states in access to each address space...................................................................... 756 appendix b memory-mapped control registers ...................................................... 786 b.1 register address map....................................................................................................... . 786 b.2 register bits .............................................................................................................. ......... 793 appendix c product lineup ............................................................................................. 805 appendix d package dimensions .................................................................................. 806
xv figures figure 1.1 block diagram ................................................................................................. 6 figure 1.2 pin assignment (fp-208c) .............................................................................. 7 figure 1.3 pin assignment (tbt-216b) ........................................................................... 8 figure 2.1user mode register configuration.................................................................. 20 figure 2.2 privileged mode register configuration ......................................................... 21 figure 2.3 general registers ............................................................................................. 22 figure 2.4 system registers.............................................................................................. 23 figure 2.5 register set overview, control registers ....................................................... 24 figure 2.6 longword ......................................................................................................... 25 figure 2.7 data format in memory................................................................................... 25 figure 2.8 processor state transitions .............................................................................. 55 figure 3.1mmu functions ............................................................................................... 59 figure 3.2 virtual address space mapping ...................................................................... 61 figure 3.3 mmu register contents .................................................................................. 65 figure 3.4 overall configuration of the tlb ................................................................... 66 figure 3.5 virtual address and tlb structure ................................................................. 67 figure 3.6 tlb indexing (ix = 1)..................................................................................... 68 figure 3.7 tlb indexing (ix = 0)..................................................................................... 69 figure 3.8 objects of address comparison ...................................................................... 70 figure 3.9 operation of ldtlb instruction ..................................................................... 74 figure 3.10 synonym problem............................................................................................ 76 figure 3.11 mmu exception generation flowchart .......................................................... 81 figure 3.12 mmu exception signals in instruction fetch ................................................. 82 figure 3.13 mmu exception signals in data access......................................................... 83 figure 3.14 specifying address and data for memory-mapped tlb access ................... 85 figure 4.1vector addresses ............................................................................................. 88 figure 4.2 example of acceptance order of general exceptions .................................... 91 figure 4.3 bit configurations of expevt, intevt, intevt2, and tra registers.... 94 figure 5.1cache structure................................................................................................ 106 figure 5.2 ccr register configuration............................................................................ 108 figure 5.3 ccr2 register configuration.......................................................................... 109 figure 5.4 cache search scheme (normal mode)............................................................ 111 figure 5.5 write-back buffer configuration .................................................................... 113 figure 5.6 specifying address and data for memory-mapped cache access................. 115 figure 6.1 intc block diagram....................................................................................... 118 figure 6.2 example of irl interrupt connection ............................................................. 122 figure 6.3 interrupt operation flowchart.......................................................................... 144 figure 6.4 example of pipeline operations when irl interrupt is accepted .................. 148 figure 7.1block diagram of user break controller ........................................................ 151 figure 8.1canceling standby mode with stbcr.stby................................................ 188 figure 8.2 power-on reset (clock modes 0, 1, 2, and 7) status output.................... 191
xvi figure 8.3 power-on reset (clock modes 3 and 4) status output ............................. 192 figure 8.4 manual reset status output ....................................................................... 192 figure 8.5 standby to interrupt status output ............................................................. 193 figure 8.6 standby to power-on reset status output ................................................. 193 figure 8.7 standby to manual reset status output ..................................................... 194 figure 8.8 sleep to interrupt status output ................................................................. 194 figure 8.9 sleep to power-on reset status output ..................................................... 195 figure 8.10 sleep to manual reset status output ......................................................... 195 figure 8.11 hardware standby mode (when ca goes low in normal operation).......... 197 figure 8.12 hardware standby mode timing (when ca goes low during wdt operation on standby mode cancellation)...................................................... 198 figure 9.1block diagram of clock pulse generator........................................................ 200 figure 9.2 state transitions for the pll standby function.............................................. 213 figure 9.3 block diagram of the wdt............................................................................. 215 figure 9.4 writing to wtcnt and wtcsr .................................................................... 218 figure 9.5 points for attention when using crystal oscillator ........................................ 221 figure 9.6 points for attention when using pll oscillator circuit................................. 222 figure 10.1 bsc functional block diagram ...................................................................... 225 figure 10.2 corresponding to logical address space and physical address space.......... 229 figure 10.3 physical space allocation................................................................................ 231 figure 10.4 pcmcia space allocation.............................................................................. 233 figure 10.5 writing to rfcr, rtcsr, rtcnt, and rtcor.......................................... 265 figure 10.6 basic timing of basic interface ...................................................................... 278 figure 10.7 example of 32-bit data-width static ram connection ................................ 279 figure 10.8 example of 16-bit data-width static ram connection ................................ 280 figure 10.9 example of 8-bit data-width static ram connection .................................. 281 figure 10.10 basic interface wait timing (software wait only) ........................................ 282 figure 10.11 basic interface wait state timing (wait state insertion by wait signal waitsel = 0)................................... 283 figure 10.12 basic interface wait state timing (wait state insertion by wait signal waitsel = 1)................................... 284 figure 10.13 example of dram connection (32-bit data width) ..................................... 286 figure 10.14 example of dram connection (16-bit data width) ..................................... 287 figure 10.15 basic timing for dram access ..................................................................... 289 figure 10.16 dram wait state timing ............................................................................... 291 figure 10.17 dram short-pitch access timing ................................................................. 292 figure 10.18 dram burst access timing ........................................................................... 294 figure 10.19 dram short-pitch burst access timing........................................................ 295 figure 10.20 normal access timing in dram edo mode................................................ 296 figure 10.21 burst access timing in dram edo mode ................................................... 297 figure 10.22 cas-before-ras refresh operation .............................................................. 298 figure 10.23 dram cas-before-ras refresh cycle timing ........................................... 299 figure 10.24 dram self-refresh cycle timing ................................................................. 301
xvii figure 10.25 example of 64-mbit synchronous dram connection (32-bit bus width) .. 303 figure 10.26 example of 64-mbit synchronous dram (16-bit bus width)...................... 304 figure 10.27 basic timing for synchronous dram burst read ........................................ 308 figure 10.28 synchronous dram burst read wait specification timing ......................... 309 figure 10.29 basic timing for synchronous dram single read ....................................... 310 figure 10.30 basic timing for synchronous dram burst write........................................ 312 figure 10.31 basic timing for synchronous dram single write ...................................... 314 figure 10.32 burst read timing (no precharge).................................................................. 317 figure 10.33 burst read timing (same row address)........................................................ 318 figure 10.34 burst read timing (different row addresses)............................................... 319 figure 10.35 burst write timing (no precharge) ................................................................ 320 figure 10.36 burst write timing (same row address) ....................................................... 321 figure 10.37 burst write timing (different row addresses).............................................. 322 figure 10.38 auto-refresh operation ................................................................................... 324 figure 10.39 synchronous dram auto-refresh timing .................................................... 325 figure 10.40 synchronous dram self-refresh timing...................................................... 327 figure 10.41 synchronous dram mode write timing ...................................................... 329 figure 10.42 burst rom wait access timing ..................................................................... 331 figure 10.43 burst rom basic access timing.................................................................... 332 figure 10.44 example of pcmcia interface........................................................................ 334 figure 10.45 basic timing for pcmcia memory card interface ....................................... 336 figure 10.46 wait timing for pcmcia memory card interface ........................................ 337 figure 10.47 basic timing for pcmcia memory card interface burst access ................. 338 figure 10.48 wait timing for pcmcia memory card interface burst access .................. 339 figure 10.49 pcmcia space allocation.............................................................................. 340 figure 10.50 basic timing for pcmcia i/o card interface................................................ 342 figure 10.51 wait timing for pcmcia i/o card interface................................................. 343 figure 10.52 dynamic bus sizing timing for pcmcia i/o card interface ....................... 344 figure 10.53 waits between access cycles.......................................................................... 346 figure 10.54 pins a25 to a0 pull-up timing ...................................................................... 347 figure 10.55 pins d31 to d0 pull-up timing (read cycle) ................................................ 348 figure 10.56 pins d31 to d0 pull-up timing (write cycle) ............................................... 348 figure 11.1 dmac block diagram .................................................................................... 355 figure 11.2 dmac transfer flowchart.............................................................................. 370 figure 11.3 round-robin mode.......................................................................................... 374 figure 11.4 changes in channel priority in round-robin mode ....................................... 375 figure 11.5 operation of direct address mode in dual address mode ............................ 377 figure 11.6 example of dma transfer timing in the direct address mode in the dual mode (transfer source: ordinary memory, transfer destination: ordinary memory) ........................................................................................... 378 figure 11.7 example of dma transfer timing in the direct address mode in the dual mode (16-byte transfer, transfer source: ordinary memory, transfer destination: ordinary memory) ...................................................................... 379
xviii figure 11.8 example of dma transfer timing in the direct address mode in the dual mode (16-byte transfer, transfer source: synchronous dram, transfer destination: ordinary memory) ...................................................................... 380 figure 11.9 operation of indirect address in the dual address mode (when the external memory space has a 16-bit width) ................................. 381 figure 11.10 example of transfer timing in the indirect address mode in the dual address mode ..................................................................................................382 figure 11.11 data flow in single address mode ................................................................. 383 figure 11.12 example of dma transfer timing in single address mode.......................... 384 figure 11.13 example of dma transfer timing in single address mode (16-byte transfer; transfer source: external memory space (ordinary memory); transfer destination: external device with dack) ..... 385 figure 11.14 transfer example in the cycle-steal mode ..................................................... 386 figure 11.15 transfer example in the burst mode ............................................................... 386 figure 11.16 bus state when multiple channels are operating .......................................... 388 figure 11.17 cycle-steal mode, level input (cpu access: 2 cycles) ................................ 390 figure 11.18 cycle-steal mode, level input (cpu access: 3 cycles) ................................ 391 figure 11.19 cycle-steal mode, level input (cpu access: 2 cycles, dma rd access: 4 cycles)..................................... 392 figure 11.20 cycle-steal mode, level input (cpu access: 2 cycles, dreq input delayed) .............................................. 393 figure 11.21 cycle-steal mode, edge input (cpu access: 2 cycles).................................. 394 figure 11.22 burst mode, level input .................................................................................. 395 figure 11.23 burst mode, edge input ................................................................................... 396 figure 11.24 source address reload function diagram...................................................... 397 figure 11.25 timing chart of source address reload function.......................................... 398 figure 11.26 cmt block diagram ....................................................................................... 401 figure 11.27 counter operation............................................................................................ 405 figure 11.28 count timing ................................................................................................... 406 figure 11.29 cmf set timing .............................................................................................. 407 figure 11.30 timing of cmf clear by the cpu................................................................... 407 figure 12.1 tmu block diagram ....................................................................................... 414 figure 12.2 setting the count operation............................................................................. 424 figure 12.3 auto-reload count operation ......................................................................... 425 figure 12.4 count timing when internal clock is operating ............................................ 425 figure 12.5 count timing when external clock is operating (both edges detected) ...... 426 figure 12.6 count timing when on-chip rtc clock is operating .................................. 426 figure 12.7 operation timing when using the input capture function (using tclk rising edge) ............................................................................. 427 figure 12.8 unf set timing............................................................................................... 427 figure 12.9 status flag clear timing ................................................................................. 428 figure 13.1 rtc block diagram ........................................................................................ 432 figure 13.2 setting the time ............................................................................................... 446
xix figure 13.3 reading the time ............................................................................................. 447 figure 13.4 using the alarm function................................................................................ 448 figure 13.5 example of crystal oscillator circuit connection .......................................... 449 figure 13.6 using periodic interrupt function.................................................................... 450 figure 14.1 sci block diagram.......................................................................................... 452 figure 14.2 scpt[1]/sck0 pin .......................................................................................... 453 figure 14.3 scpt[0]/txd0 pin........................................................................................... 454 figure 14.4 scpt[0]/rxd0 pin .......................................................................................... 455 figure 14.5 data format in asynchronous communication .............................................. 479 figure 14.6 output clock and serial data timing (asynchronous mode) ........................ 481 figure 14.7 sample flowchart for sci initialization .......................................................... 482 figure 14.8 sample flowchart for transmitting serial data .............................................. 483 figure 14.9 sci transmit operation in asynchronous mode ............................................ 485 figure 14.10 sample flowchart for receiving serial data................................................... 486 figure 14.11 sci receive operation .................................................................................... 489 figure 14.12 communication among processors using multiprocessor format ................ 490 figure 14.13 sample flowchart for transmitting multiprocessor serial data ..................... 491 figure 14.14 sci multiprocessor transmit operation.......................................................... 493 figure 14.15 sample flowchart for receiving multiprocessor serial data.......................... 494 figure 14.16 example of sci receive operation ................................................................. 496 figure 14.17 data format in clock synchronous communication ...................................... 498 figure 14.18 sample flowchart for sci initialization .......................................................... 500 figure 14.19 sample flowchart for serial transmitting....................................................... 501 figure 14.20 example of sci transmit operation ............................................................... 502 figure 14.21 sample flowchart for serial data receiving................................................... 504 figure 14.22 example of sci receive operation ................................................................. 506 figure 14.23 sample flowchart for serial data transmitting/receiving ............................. 507 figure 14.24 receive data sampling timing in asynchronous mode ................................ 510 figure 15.1 smart card interface block diagram .............................................................. 514 figure 15.2 pin connection diagram for the smart card interface.................................... 519 figure 15.3 data format for smart card interface ............................................................. 520 figure 15.4 waveform of start character ........................................................................... 522 figure 15.5 initialization flowchart (example) .................................................................. 526 figure 15.6 transmission flowchart ................................................................................... 528 figure 15.7 reception flowchart (example) ...................................................................... 530 figure 15.8 receive data sampling timing in smart card mode...................................... 532 figure 15.9 retransmission in sci receive mode ............................................................. 533 figure 15.10 retransmission in sci transmit mode............................................................ 534 figure 16.1 scif block diagram........................................................................................ 536 figure 16.2 scpt[5]/sck2 pin .......................................................................................... 537 figure 16.3 scpt[4]/txd2 pin........................................................................................... 538 figure 16.4 scpt[4]/rxd2 pin .......................................................................................... 539 figure 16.5 sample scif initialization flowchart.............................................................. 564
xx figure 16.6 sample serial transmission flowchart............................................................ 565 figure 16.7 example of transmit operation (example with 8-bit data, parity, one stop bit) ............................................ 567 figure 16.8 example of operation using modem control (cts2).................................... 567 figure 16.9 sample serial reception flowchart (1) ........................................................... 568 figure 16.10 sample serial reception flowchart (2) ........................................................... 569 figure 16.11 example of scif receive operation (example with 8-bit data, parity, one stop bit) ............................................ 570 figure 16.12 example of operation using modem control ( rts2 ).................................... 571 figure 16.13 receive data sampling timing in asynchronous mode ................................ 573 figure 17.1 irda block diagram........................................................................................ 576 figure 17.2 scpt[3]/sck1 pin .......................................................................................... 577 figure 17.3 scpt[2]/txd1 pin........................................................................................... 578 figure 17.4 scpt[2]/rxd1 pin .......................................................................................... 579 figure 17.5 transmit/receive operation ............................................................................ 584 figure 19.1 port a .............................................................................................................. . 605 figure 19.2 port b .............................................................................................................. . 607 figure 19.3 port c .............................................................................................................. . 609 figure 19.4 port d .............................................................................................................. .611 figure 19.5 port e.............................................................................................................. .. 613 figure 19.6 port f.............................................................................................................. .. 615 figure 19.7 port g .............................................................................................................. .617 figure 19.8 port h .............................................................................................................. .619 figure 19.9 port j .............................................................................................................. .. 621 figure 19.10 port k ............................................................................................................. .. 623 figure 19.11 port l............................................................................................................. ... 625 figure 19.12 sc port ............................................................................................................ . 627 figure 20.1a/d converter block diagram ........................................................................ 630 figure 20.2 example of word access................................................................................. 637 figure 20.3 example of longword access ......................................................................... 637 figure 20.4 a/d data register access operation (reading h'aa40) ............................... 638 figure 20.5 example of a/d converter operation (single mode, channel 1 selected) .... 640 figure 20.6 example of a/d converter operation (multi mode, channels an0 to an2 selected) ..................................................................... 642 figure 20.7 example of a/d converter operation (scan mode, channels an0 to an2 selected)................................................ 644 figure 20.8 a/d conversion timing .................................................................................. 645 figure 20.9 external trigger input timing ......................................................................... 646 figure 20.10 definitions of a/d conversion accuracy........................................................ 648 figure 20.11 example of analog input protection circuit ................................................... 649 figure 20.12 analog input pin equivalent circuit................................................................ 649 figure 21.1 d/a converter block diagram ........................................................................ 651 figure 21.2 example of d/a converter operation ............................................................. 655
xxi figure 22.1h-udi block diagram..................................................................................... 658 figure 22.2 tap controller state transitions..................................................................... 667 figure 22.3 h-udi reset .................................................................................................... 669 figure 23.1extal clock input timing............................................................................ 683 figure 23.2 ckio clock input timing ............................................................................... 683 figure 23.3 ckio clock output timing ............................................................................ 683 figure 23.4 power-on oscillation settling time................................................................. 684 figure 23.5 oscillation settling time at standby return (return by reset)...................... 684 figure 23.6 oscillation settling time at standby return (return by nmi) ....................... 685 figure 23.7 oscillation settling time at standby return (return by irq4 to irq0)........ 685 figure 23.8 pll synchronization settling time by reset or nmi .................................... 686 figure 23.9 pll synchronization settling time by irq/irl interrupt ............................. 686 figure 23.10 pll synchronization settling time when frequency multiplication rate modified .................................................................................................. 687 figure 23.11 reset input timing .......................................................................................... 689 figure 23.12 interrupt signal input timing .......................................................................... 689 figure 23.13 irqout timing.............................................................................................. 689 figure 23.14 bus release timing ......................................................................................... 690 figure 23.15 pin drive timing at standby ........................................................................... 690 figure 23.16 basic bus cycle (no wait).............................................................................. 693 figure 23.17 basic bus cycle (one wait) ............................................................................ 694 figure 23.18 (1) basic bus cycle (external wait, waitsel = 0) ........................................... 695 figure 23.18 (2) basic bus cycle (external wait, waitsel = 1) ........................................... 696 figure 23.19 burst rom bus cycle (no wait).................................................................... 697 figure 23.20 burst rom bus cycle (two waits)................................................................ 698 figure 23.21burst rom bus cycle (external wait, waitsel = 0).................................. 699 figure 23.22 dram bus cycle (trcd = 0, anw = 1, tpc = 0) ....................................... 700 figure 23.23 dram bus cycle (trcd = 2, anw = 2, tpc = 1) ....................................... 701 figure 23.24 dram burst bus cycle (trcd = 0, anw = 1, tpc = 0) ............................. 702 figure 23.25 dram burst bus cycle (trcd = 2, anw = 2, tpc = 0) ............................. 703 figure 23.26 dram bus cycle (edo mode, trcd = 0, anw = 1, tpc = 0) ................... 704 figure 23.27 dram bus cycle (edo mode, trcd = 2, anw = 2, tpc = 1) ................... 705 figure 23.28 dram burst bus cycle (edo mode, trcd = 0, anw = 1, tpc = 0) ......... 706 figure 23.29 dram burst bus cycle (edo mode, trcd = 2, anw = 2, tpc = 0) ......... 707 figure 23.30 dram short-pitch access timing ................................................................. 708 figure 23.31dram short-pitch access timing (edo mode)............................................ 709 figure 23.32 dram cas-before-ras refresh cycle (tras = 0, tpc = 0)..................... 710 figure 23.33 dram cas-before-ras refresh cycle (tras = 3, tpc = 2)..................... 710 figure 23.34 dram self-refresh cycle (tpc = 0) .............................................................. 711 figure 23.35 synchronous dram read bus cycle (rcd = 0, cas latency = 1, tpc = 0)............................................................ 712 figure 23.36 synchronous dram read bus cycle (rcd = 2, cas latency = 2, tpc = 1)............................................................ 713
xxii figure 23.37 synchronous dram read bus cycle (burst read (single read 4), rcd = 0, cas latency = 1, tpc = 1)........... 714 figure 23.38 synchronous dram read bus cycle (burst read (single read 4), rcd = 1, cas latency = 3, tpc = 0)........... 715 figure 23.39 synchronous dram write bus cycle (rcd = 0, tpc = 0, trwl = 0)....... 716 figure 23.40 synchronous dram write bus cycle (rcd = 2, tpc = 1, trwl = 1)....... 717 figure 23.41synchronous dram write bus cycle (burst mode (single write 4), rcd = 0, tpc = 1, trwl = 0)....................................................................... 718 figure 23.42 synchronous dram write bus cycle (burst mode (single write 4), rcd = 1, tpc = 0, trwl = 0)....................................................................... 719 figure 23.43 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 1) ..................................... 720 figure 23.44 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 2) ..................................... 721 figure 23.45 synchronous dram burst read bus cycle (ras down, different row address, tpc = 0, rcd = 0, cas latency = 1) ..................... 722 figure 23.46 synchronous dram burst read bus cycle (ras down, different row address, tpc = 1, rcd = 0, cas latency = 1) ..................... 723 figure 23.47 synchronous dram burst write bus cycle (ras down, same row address) ................................................................... 724 figure 23.48 synchronous dram burst write bus cycle (ras down, different row address, tpc = 0, rcd = 0) ............................. 725 figure 23.49 synchronous dram burst write bus cycle (ras down, different row address, tpc = 1, rcd = 1) ............................. 726 figure 23.50 synchronous dram auto-refresh timing (tras = 1, tpc = 1) ................ 727 figure 23.51synchronous dram self-refresh cycle (tpc = 0) ....................................... 728 figure 23.52 synchronous dram mode register write cycle........................................... 729 figure 23.53 pcmcia memory bus cycle (ted = 0, teh = 0, no wait) ........................ 730 figure 23.54 pcmcia memory bus cycle (ted = 2, teh = 1, one wait, external wait, waitsel = 0) ..................... 731 figure 23.55 pcmcia memory bus cycle (burst read, ted = 0, teh = 0, no wait)..... 732 figure 23.56 pcmcia memory bus cycle (burst read, ted = 1, teh = 1, two waits, burst pitch = 3, waitsel = 0)................................................... 733 figure 23.57 pcmcia i/o bus cycle (ted = 0, teh = 0, no wait) ................................. 734 figure 23.58 pcmcia i/o bus cycle (ted = 2, teh = 1, one wait, external wait, waitsel = 0)...................... 735 figure 23.59 pcmcia i/o bus cycle (ted = 1, teh = 1, one wait, bus sizing, waitsel = 0) .......................... 736 figure 23.60 tclk input timing ......................................................................................... 738 figure 23.61tclk clock input timing .............................................................................. 738 figure 23.62 oscillation settling time at rtc crystal oscillator power-on....................... 738 figure 23.63 sck input clock timing ................................................................................. 738 figure 23.64 sci i/o timing in clock synchronous mode ................................................. 739
xxiii figure 23.65 i/o port timing................................................................................................ 739 figure 23.66 dreq input timing ........................................................................................ 739 figure 23.67 drak output timing ..................................................................................... 740 figure 23.68 tck input timing ........................................................................................... 740 figure 23.69 trst input timing (reset hold) .................................................................... 741 figure 23.70 h-udi data transfer timing .......................................................................... 741 figure 23.71asemd0 input timing ................................................................................... 741 figure 23.72 external trigger input timing ......................................................................... 742 figure 23.73 a/d conversion timing .................................................................................. 743 figure 23.74 output load circuit ......................................................................................... 744 figure 23.75 load capacitance vs. delay time ................................................................... 745 figure d.1package dimensions (fp-208c) ...................................................................... 806 figure d.2 package dimensions (tbt-216b) ................................................................... 807
xxiv tables table 1.1 sh7709a features............................................................................................... 2 table 1.2 characteristics...................................................................................................... 5 table 1.3 sh7709a pin function........................................................................................ 9 table 2.1 initial register values ......................................................................................... 22 table 2.2 addressing modes and effective addresses ....................................................... 28 table 2.3 instruction formats.............................................................................................. 32 table 2.4 classification of instructions ............................................................................... 35 table 2.5 instruction code format...................................................................................... 38 table 2.6 data transfer instructions ................................................................................... 39 table 2.7 arithmetic instructions........................................................................................ 41 table 2.8 logic operation instructions ............................................................................... 44 table 2.9 shift instructions.................................................................................................. 4 5 table 2.10 branch instructions.............................................................................................. 46 table 2.11 system control instructions ................................................................................ 47 table 2.12 instruction code map .......................................................................................... 51 table 3.1 register configuration ........................................................................................ 63 table 3.2 access states designated by d, c, and pr bits.................................................. 71 table 4.1 register configuration ........................................................................................ 87 table 4.2 exception event vectors ..................................................................................... 89 table 4.3 exception codes.................................................................................................. 92 table 4.4 types of reset ..................................................................................................... 97 table 5.1 cache specifications............................................................................................ 105 table 5.2 lru and way replacement................................................................................ 107 table 5.3 register configuration ........................................................................................ 107 table 5.4 lru and way replacement (when w2lock=1).............................................. 109 table 5.5 lru and way replacement (when w3lock=1).............................................. 109 table 5.6 lru and way replacement (when w2lock=1 and w3lock=1) ................. 110 table 6.1 pin configuration ................................................................................................ 119 table 6.2 register configuration ........................................................................................ 120 table 6.3 irl3 C irl0 / irls3 C irls0 pins and interrupt levels ........................................ 123 table 6.4 interrupt exception handling sources and priority (irq mode)........................ 126 table 6.5 interrupt exception handling sources and priority (irl mode)........................ 128 table 6.6 interrupt level and intevt code...................................................................... 130 table 6.7 interrupt request sources and ipraCipre ........................................................ 131 table 6.8 interrupt response time...................................................................................... 146 table 7.1 register configuration ........................................................................................ 152 table 7.2 data access cycle addresses and operand size comparison conditions ......... 172 table 8.1 power-down modes............................................................................................ 182 table 8.2 pin configuration ................................................................................................ 182 table 8.3 register configuration ........................................................................................ 183 table 8.4 register states in standby mode......................................................................... 187
xxv table 9.1 clock pulse generator pins and functions.......................................................... 202 table 9.2 register configuration ........................................................................................ 202 table 9.3 clock operating modes....................................................................................... 203 table 9.4 available combination of clock mode and frqcr values.............................. 205 table 9.5 register configuration ........................................................................................ 215 table 10.1 pin configuration ................................................................................................ 226 table 10.2 register configuration ........................................................................................ 228 table 10.3 physical address space map............................................................................... 230 table 10.4 correspondence between external pins (md4 and md3) and memory size..... 231 table 10.5 pcmcia interface characteristics...................................................................... 232 table 10.6 pcmcia support interface ................................................................................. 233 table 10.7 32-bit external device/big endian access and data alignment ....................... 268 table 10.8 16-bit external device/big endian access and data alignment ....................... 269 table 10.9 8-bit external device/big endian access and data alignment ......................... 270 table 10.10 32-bit external device/little endian access and data alignment .................... 271 table 10.11 16-bit external device/little endian access and data alignment .................... 272 table 10.12 8-bit external device/little endian access and data alignment ...................... 273 table 10.13 relationship between amx1-0 and address multiplexing ................................ 288 table 10.14 relationship between bus width, amx, and address multiplex output .......... 305 table 10.15 example of correspondence between sh7709a and synchronous dram address pins (amx (2-0) = 011 (32-bit bus width)) ..... 307 table 10.16 mcscrx settings and mcs[x] assertion conditions (x: 0C7).......................... 350 table 11.1 pin configuration ................................................................................................ 356 table 11.2 dmac registers ................................................................................................. 356 table 11.3 selecting external request modes with the rs bits........................................... 371 table 11.4 selecting on-chip peripheral module request modes with the rs bit ............. 372 table 11.5 supported dma transfers .................................................................................. 376 table 11.6 relationship of request modes and bus modes by dma transfer category.... 387 table 11.7 register configuration ........................................................................................ 402 table 11.8 transfer conditions and register settings for transfer between on-chip sci and external memory...................................................... 408 table 11.9 transfer conditions and register settings for transfer between on-chip a/d converter and external memory..................................... 409 table 11.10 values in the dmac after the fourth transfer ends.......................................... 410 table 11.11 transfer conditions and register settings for transfer between external memory and scif transmitter............................................... 411 table 12.1 pin configuration ................................................................................................ 415 table 12.2 tmu register configuration .............................................................................. 415 table 12.3 tmu interrupt sources........................................................................................ 428 table 13.1 rtc pin configuration........................................................................................ 433 table 13.2 rtc registers...................................................................................................... 4 34 table 13.3 day-of-week codes (rwkcnt) ....................................................................... 437 table 13.4 day-of-week codes (rwkar).......................................................................... 441
xxvi table 13.5 recommended oscillator circuit constants (recommended values)................ 449 table 14.1 sci pins ............................................................................................................ ... 455 table 14.2 registers ........................................................................................................... ... 456 table 14.3 scsmr settings.................................................................................................. 469 table 14.4 bit rates and scbrr settings in asynchronous mode ..................................... 470 table 14.5 bit rates and scbrr settings in clock synchronous mode ............................. 474 table 14.6 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) ......................................................................................... 475 table 14.7 maximum bit rates during external clock input (asynchronous mode).......... 476 table 14.8 maximum bit rates during external clock input (clock synchronous mode)................................................................................. 476 table 14.9 serial mode register settings and sci communication formats ...................... 478 table 14.10 scsmr and scscr settings and sci clock source selection ......................... 478 table 14.11 serial communication formats (asynchronous mode)...................................... 480 table 14.12 receive error conditions and sci operation ..................................................... 488 table 14.13 sci interrupt sources .......................................................................................... 508 table 14.14 scssr status flags and transfer of receive data............................................. 509 table 15.1 sci pins ............................................................................................................ ... 515 table 15.2 registers ........................................................................................................... ... 515 table 15.3 register settings for the smart card interface.................................................... 521 table 15.4 relationship of n to cks1 and cks0 ................................................................. 523 table 15.5 examples of bit rate b (bit/s) for scbrr settings (n = 0)............................... 523 table 15.6 examples of scbrr settings for bit rate b (bit/s) (n = 0)............................... 523 table 15.7 maximum bit rates for frequencies (smart card interface mode) ................... 524 table 15.8 register set values and sck pin........................................................................ 524 table 15.9 smart card mode operating state and interrupt sources ................................... 531 table 16.1 scif pins ........................................................................................................... .. 539 table 16.2 registers ........................................................................................................... ... 540 table 16.3 scsmr2 settings................................................................................................ 551 table 16.4 bit rates and scbrr2 settings.......................................................................... 552 table 16.5 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) ......................................................................................... 556 table 16.6 maximum bit rates during external clock input (asynchronous mode).......... 557 table 16.7 scsmr2 settings and scif communication formats ....................................... 561 table 16.8 scscr2 settings and scif clock source selection.......................................... 562 table 16.9 serial communication formats ........................................................................... 562 table 16.10 scif interrupt sources ........................................................................................ 572 table 17.1 pin configuration ................................................................................................ 579 table 17.2 register configuration ........................................................................................ 580 table 18.1 list of multiplexed pins ...................................................................................... 585 table 18.2 pin function controller registers ....................................................................... 589 table 19.1 register descriptions........................................................................................... 605 table 19.2 read/write operation of the port a data register (padr)............................... 606
xxvii table 19.3 register descriptions........................................................................................... 607 table 19.4 read/write operation of the port b data register (pbdr) .............................. 608 table 19.5 register description ............................................................................................ 609 table 19.6 read/write operation of the port c data register (pcdr) ............................... 610 table 19.7 register descriptions........................................................................................... 611 table 19.8 read/write operation of the port d data register (pddr)............................... 612 table 19.9 register descriptions........................................................................................... 613 table 19.10 read/write operation of the port e data register (pedr)................................ 614 table 19.11 register descriptions........................................................................................... 615 table 19.12 read/write operation of the port f data register (pfdr) ................................ 616 table 19.13 register descriptions........................................................................................... 617 table 19.14 read/write operation of the port g data register (pgdr)............................... 618 table 19.15 register descriptions........................................................................................... 619 table 19.16 read/write operation of the port h data register (phdr).............................. 620 table 19.17 register descriptions........................................................................................... 621 table 19.18 read/write operation of the port j data register (pjdr).................................. 622 table 19.19 register descriptions........................................................................................... 623 table 19.20 read/write operation of the port k data register (pkdr)............................... 624 table 19.21 register descriptions........................................................................................... 625 table 19.22 read/write operation of the port l data register (pldr)................................ 626 table 19.23 register descriptions........................................................................................... 627 table 19.24 read/write operation of the sc port data register (scpdr)........................... 628 table 20.1a/d converter pins.............................................................................................. 631 table 20.2 a/d converter registers...................................................................................... 632 table 20.3 analog input channels and a/d data registers ................................................. 633 table 20.4 a/d conversion time (single mode) ................................................................. 646 table 20.5 analog input pin ratings .................................................................................... 649 table 20.6 relationship between access size and read data.............................................. 650 table 21.1 d/a converter pins.............................................................................................. 652 table 21.2 d/a converter registers...................................................................................... 652 table 22.1 h-udi registers.................................................................................................. 659 table 22.2 h-udi commands............................................................................................... 660 table 22.3 sh7709a pins and boundary scan register bits ............................................... 661 table 22.4 reset configuration ............................................................................................. 668 table 23.1 absolute maximum ratings................................................................................ 673 table 23.2 dc characteristics (ta = C20 to 75c) ............................................................... 675 table 23.3 permitted output current values (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) .............................................................. 677 table 23.4 maximum operating frequencies (vccq = 3.3 0.3 v, vccq = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) .............................................................. 678 table 23.5 clock timing (1) (vccq = 3.3 0.3 v, vccq = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 20 mhz) ..... 679
xxviii table 23.5 clock timing (2) (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 33 mhz) ..... 681 table 23.5 clock timing (3) (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 66 mhz) ..... 682 table 23.6 control signal timing (vcc = 3.3 0.3 v, vcc (1.8 v) = 3.3 0.3 v, avcc = 3.3 0.3 v, ta = C20 t o 75c) ............................................................... 688 table 23.7 bus timing (clock modes 0/1/2/3/4/7, vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c)................................ 691 table 23.8 peripheral module signal timing (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) .............................................................. 737 table 23.9 h-udi-related pin timing (v cc q = 3.3 0.3v, v cc = 1.9/1.8 0.15, avcc = 3.3 0.3v, ta = C20 to 75 c).............................................................. 740 table 23.10 a/d converter timing (vccq = 3.3 0.3 v, vcc = 1.9/1.8 0.15 v, avcc = 3.3 0.3 v, ta = C20 to 75c) .............................................................. 742 table 23.11 a/d converter characteristics (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) .............................................................. 746 table 23.12 d/a converter characteristics (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) .............................................................. 746 table a.1 pin states during resets, power-down states, and bus-released state............. 747 table a.2 pin specifications ................................................................................................ 751 table a.3 pin states (normal memory/little endian) ........................................................ 756 table a.4 pin states (normal memory/big endian)............................................................ 759 table a.5 pin states (burst rom/little endian)................................................................. 762 table a.6 pin states (burst rom/big endian).................................................................... 765 table a.7 pin states (dram/little endian)........................................................................ 768 table a.8 pin states (dram/big endian) .......................................................................... 771 table a.9 pin states (synchronous dram/little endian).................................................. 774 table a.10 pin states (synchronous dram/big endian) .................................................... 776 table a.11 pin states (pcmcia/little endian) .................................................................... 778 table a.12 pin states (pcmcia/big endian) ....................................................................... 782 table b.1 memory-mapped control registers.................................................................... 786 table b.2 register bits ........................................................................................................ 793 table c.1 sh7709a product lineup.................................................................................... 805
1 section 1 overview and pin functions 1.1 sh7709a features this lsi is a single-chip risc microprocessor that integrates a hitachi-original risc-type superh tm * architecture cpu as its core that has an on-chip multiplier, cache memory, and a memory management unit (mmu) as well as peripheral functions required for system configuration such as a timer, a realtime clock, an interrupt controller, and a serial communication interface. this lsi includes data protection, virtual memory, and other functions provided by incorporating an mmu into a superh series microprocessor (sh-1 or sh-2). high-speed data transfers can be performed by an on-chip direct memory access controller (dmac) and an external memory access support function enables direct connection to different types of memory. the sh7709a microprocessor also supports an infrared communication function, an a/d converter, and a d/a converter. a powerful built-in power management function keeps power consumption low, even during high- speed operation. this lsi can run at eight times the frequency of the system bus operating speed, making it optimum for electrical devices such as pdas that require both high speed and low power. the features of this lsi is listed in table 1.1. the specifications are shown in table 1.2. note: superh is a trademark of hitachi, ltd.
2 table 1.1 sh7709a features item features cpu ? original hitachi superh architecture ? object code level compatible with sh-1, sh-2 and sh-3 (sh7708) ? 32-bit internal data bus ? general-register files ? sixteen 32-bit general registers (eight 32-bit shadow registers) ? eight 32-bit control registers ? four 32-bit system registers ? risc-type instruction set ? instruction length: 16-bit fixed length for improved code efficiency ? load-store architecture ? delayed branch instructions ? instruction set based on c language ? instruction execution time: one instruction/cycle for basic instructions ? logical address space: 4 gbytes ? space identifier asid: 8 bits, 256 logical address space ? five-stage pipeline clock pulse generator (cpg) ? clock mode: an input clock can be selected from the external input (extal or ckio) or crystal oscillator. ? three types of clocks generated: ? cpu clock: 1C16 times the input clock, maximum 133.34 mhz ? bus clock: 1C4 times the input clock, maximum 66.67 mhz ? peripheral clock: 1/4C4 times the input clock, maximum 33.34 mhz ? power-down modes: ? sleep mode ? standby mode ? module standby mode ? one-channel watchdog timer memory management unit (mmu) ? 4 gbytes of address space, 256 address spaces (asid 8 bits) ? page unit sharing ? supports multiple page sizes: 1, 4 kbytes ? 128-entry, 4-way set associative tlb ? supports software selection of replacement method and random-replacement algorithms ? contents of tlb are directly accessible by address mapping
3 table 1.1 sh7709a features (cont) item features cache memory ? 16-kbyte cache, mixed instruction/data ? 256 entries, 4-way set associative, 16-byte block length ? write-back, write-through, lru replacement algorithm ? 1-stage write-back buffer ? maximum 2 ways of the cache can be locked interrupt controller (intc) ? eleven external interrupt pins (nmi, irq5Cirq0, irls3 C irls0 ) ? on-chip peripheral interrupts: set priority levels for each module user break controller (ubc) ? 2 break channels ? addresses, data values, type of access, and data size can all be set as break conditions ? supports a sequential break function bus state controller (bsc) ? physical address space divided into six areas (area 0, areas 2 to 6), each a maximum of 64 mbytes, with the following features settable for each area: ? bus size (8, 16, or 32 bits) ? number of wait cycles (also supports a hardware wait function) ? setting the type of space enables direct connection to sram, dram, synchronous dram, and burst rom ? supports pcmcia interface (2 channels) ? outputs chip select signal (cs0, cs2Ccs6) for corresponding area ? dram/synchronous dram refresh function ? programmable refresh interval ? supports cas-before-ras refresh and self-refresh modes ? supports power-down dram ? dram/synchronous dram burst access function ? usable as either big or little endian machine hitachi user- debugging interface (h-udi) ? e10a emulator support ? jtag-standard pin assignment ? realtime branch address trace ? 1-kb on-chip ram for fast emulation program execution timer (tmu) ? 3-channel auto-reload-type 32-bit timer ? input capture function ? 6 types of counter input clocks can be selected ? maximum resolution: 2 mhz
4 table 1.1 sh7709a features (cont) item features realtime clock (rtc) ? built-in clock, calendar functions, and alarm functions ? on-chip 32-khz crystal oscillator circuit with a maximum resolution (interrupt cycle) of 1/256 second serial communi- cation interface 0 (sci0/sci) ? asynchronous mode or clock synchronous mode can be selected ? full-duplex communication ? supports smart card interface serial communi- cation interface 1 (sci1/irda) ? 16-byte fifo for transmission/reception ? dma can be transferred ? irda: interface based on 1.0 serial communi- cation interface 2 (sci2/scif) ? 16-byte fifo for transmission/reception ? dma can be transferred ? hardware flow control direct memory access controller (dmac) ? 4 channels ? burst mode and cycle-steal mode i/o port ? twelve 8-bit ports a/d converter (adc) ? 10 bits 4 lsb, 8 channels ? conversion time: 10 s ? input range: 0Cvcc (max. 3.6 v) d/a converter (dac) ? 8 bits 4 lsb, 2 channels ? conversion time: 10 s ? output range: 0Cvcc (max. 3.6 v) product lineup power supply voltage operating abbr. i/o internal frequency model name packege sh7709a 3.3 0.3v 1.9 0.15v 133mhz hd6417709af133 208-pin plastic lqfp (fp-208c) HD6417709ABT133 216-pin tfbga (tbt-216b) 1.8 0.15v 100mhz hd6417709af100 208-pin plastic lqfp (fp-208c) hd6417709abt100 216-pin tfbga (tbt-216b)
5 table 1.2 characteristics item characteristics power supply voltage ? i/o: 3.3 0.3 v internal: 1.9 0.15 v (133 mhz model), 1.8 0.15 v (100 mhz model) operating frequency ? internal frequency: maximum 133.34 mhz (133 mhz model), 100 mhz (100 mhz model); external frequency: maximum 66.67 mhz process ? 0.25-m cmos/3-layer metal
6 1.2 block diagram mmu tlb sh-3 cpu ubc sci tmu rtc irda scif adc dac aud dmac cmt i/o port external bus interface bsc ccn cache aseram udi intc cpg/wdt peripheral bus 1 peripheral bus 2 i bus l bus legend: adc: aseram: aud: bsc: cache: ccn: cmt: cpg/wdt: cpu: dac: dmac: h-udi: a/d converter ase memory advanced user debugger bus state controller cache memory cache memory controller compare match timer clock pulse generator/watchdog timer central processing unit d/a converter direct memory access controller hitachi user-debugging interface intc: irda: mmu: rtc: sci: scif: tlb: tmu: ubc: interrupt controller serial communicatiion interface (with irda) memory management unit realtime clock serial communication interface (with smart card interface)  
 

'   *-*$ address translation buffer timer unit user break controller figure 1.1 block diagram
7 1.3 pin description 1.3.1 pin assignment 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 md1 md2 v cc -rtc xtal2 extal2 v ss -rtc nmi irq0/ irl0 /pth[0] irq1/ irl1 /pth[1] irq2/ irl2 /pth[2] irq3/ irl3 /pth[3] irq4/pth[4] d31/ptb[7] d30/ptb[6] d29/ptb[5] d28/ptb[4] d27/ptb[3] d26/ptb[2] v ss q d25/ptb[1] v cc q d24/ptb[0] d23/pta[7] d22/pta[6] d21/pta[5] d20/pta[4] v ss d19/pta[3] v cc d18/pta[2] d17/pta[1] d16/pta[0] v ss q d15 v cc q d14 d13 d12 d11 d10 d9 d8 d7 d6 v ss q d5 v cc q d4 d3 d2 d1 d0 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 extal xtal v cc v ss v ss audck/pth[6] v cc -pll2 cap2 v ss -pll2 v ss -pll1 cap1 v cc -pll1 md0 irls0 /ptf[0]/pint[8] irls1 /ptf[1]/pint[9] irls2 /ptf[2]/pint[10] irls3 /ptf[3]/pint[11] tck/ptf[4]/pint[12] tdi/ptf[5]/pint[13] tms/ptf[6]/pint[14] trst /ptf[7]/pint[15] 41484i"j28&i"j v cc audata[1]/ptg[1] v ss audata[2]/ptg[2] audata[3]/ptg[3] ptg[4] asebrkak /ptg[5] asemd0 /ptg[6] iois16 /ptg[7] adtrg /pth[5] resetm wait breq back tdo/pte[0] ras2u /pte[1] ras3u /pte[2] cas2h /pte[3] cas2l /pte[6] dack1/ptd[7] dack0/ptd[5] cashh /ptj[5] cashl /ptj[4] v cc q caslh / casu /ptj[3] v ss q casll / casl /ptj[2] ras2l /ptj[1] ras3l /ptj[0] cke/ptk[5] 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 status0/ptj[6] status1/ptj[7] tclk/pth[7] i rqout v ss q ckio v cc q txd0/scpt[0] sck0/scpt[1] txd1/scpt[2] sck1/scpt[3] txd2/scpt[4] sck2/scpt[5] rts2 /scpt[6] rxd0/scpt[0] rxd1/scpt[2] v ss rxd2/scpt[4] v cc cts2 /irq5/scpt[7] mcs[7] /ptc[7]/pint[7] mcs[6] /ptc[6]/pint[6] mcs[5] /ptc[5]/pint[5] mcs[4] /ptc[4]/pint[4] v ss q wakeup /ptd[3] v cc q resetout /ptd[2] mcs[3] /ptc[3]/pint[3] mcs[2] /ptc[2]/pint[2] mcs[1] /ptc[1]/pint[1] mcs[0] /ptc[0]/pint[0] drak0/ptd[1] drak1/ptd[0] dreq0 /ptd[4] dreq1 /ptd[6] resetp ca md3 md4 md5 av ss an[0]/ptl[0] an[1]/ptl[1] an[2]/ptl[2] an[3]/ptl[3] an[4]/ptl[4] an[5]/ptl[5] av cc an[6]/da[1]/ptl[6] an[7]/da[0]/ptl[7] av ss 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 ce2b /pte[5] ce2a /pte[4] cs6 / ce1b cs5/ce1a /ptk[3] cs4 /ptk[2] cs3 /ptk[1] cs2 /ptk[0] v cc q cs0 / mcs0 v ss q audsync /pte[7] rd/ wr we3 /dqmuu/ iciowr /ptk[7] we2 /dqmul/ iciord /ptk[6] we1 /domlu/ we we0 /dqmll rd bs /ptk[4] a25 v cc q a24 v ss q a23 v cc a22 v ss a21 a20 a19 a18 a17 a16 a15 v cc q a14 v ss q a13 a12 a11 a10 a9 a8 a7 a6 a5 v cc q a4 v ss q a3 a2 a1 a0 sh7709a fp-208c (top view) index mark figure 1.2 pin assignment (fp-208c)
8 29 # ! / 5 3    " g # ! / 5 3    " g 8 7 6 5 4 3 2 1 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 a b c d e f g h j k l m n p r t u v w y aa ab ac ad ae af ag ah aj a b c d e f g h j k l m n p r t u v w y aa ab ac ad ae af ag ah aj sh7709a tbt-216b (top view) index mark note: sections in the dotted lines are perspective view. figure 1.3 pin assignment (tbt-216b)
9 1.3.2 pin function table 1.3 sh7709a pin function number of pins fp-208c tbt-216b pin name i/o description 1 b02 md1 i clock mode setting 2 a02 md2 i clock mode setting 3 b03 vcc-rtc * 1 rtc power supply (1.9 v/1.8 v * 5 ) 4 a03 xtal2 o on-chip rtc crystal oscillator pin 5 b04 extal2 i on-chip rtc crystal oscillator pin 6 a04 vss-rtc * 1 rtc power supply (0 v) 7 b05 nmi i nonmaskable interrupt request 8 a05 irq0/ irl0 /pth[0] i external interrupt request/input port h 9 b06 irq1/ irl1 /pth[1] i external interrupt request/input port h 10 a06 irq2/ irl2 /pth[2] i external interrupt request/input port h 11 b07 irq3/ irl3 /pth[3] i external interrupt request/input port h 12 a07 irq4/pth[4] i external interrupt request/input port h 13 b08 d31/ptb[7] i/o data bus / input/output port b 14 a08 d30/ptb[6] i/o data bus / input/output port b 15 b09 d29/ptb[5] i/o data bus / input/output port b 16 a09 d28/ptb[4] i/o data bus / input/output port b 17 b10 d27/ptb[3] i/o data bus / input/output port b 18 a10 d26/ptb[2] i/o data bus / input/output port b 19 b11 vssq input/output power supply (0 v) 20 a11 d25/ptb[1] i/o data bus / input/output port b 21 b12 vccq input/output power supply (3.3 v) 22 a12 d24/ptb[0] i/o data bus / input/output port b 23 b13 d23/pta[7] i/o data bus / input/output port a 24 a13 d22/pta[6] i/o data bus / input/output port a 25 b14 d21/pta[5] i/o data bus / input/output port a
10 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 26 a14 d20/pta[4] i/o data bus / input/output port a 27 b15 vss power supply (0 v) 28 a15 d19/pta[3] i/o data bus / input/output port a 29 b16 vcc power supply (1.9 v/1.8 v * 5 ) 30 a16 d18/pta[2] i/o data bus / input/output port a 31 b17 d17/pta[1] i/o data bus / input/output port a 32 a17 d16/pta[0] i/o data bus / input/output port a 33 b18 vssq input/output power supply (0 v) 34 a18 d15 i/o data bus 35 b19 vccq input/output power supply (3.3 v) 36 a19 d14 i/o data bus 37 b20 d13 i/o data bus 38 a20 d12 i/o data bus 39 b21 d11 i/o data bus 40 a21 d10 i/o data bus 41 b22 d9 i/o data bus 42 a22 d8 i/o data bus 43 b23 d7 i/o data bus 44 a23 d6 i/o data bus 45 b24 vssq input/output power supply (0 v) 46 a24 d5 i/o data bus 47 b25 vccq input/output power supply (3.3 v) 48 a25 d4 i/o data bus 49 b26 d3 i/o data bus 50 a26 d2 i/o data bus 51 b27 d1 i/o data bus 52 a27 d0 i/o data bus 53 b28 a0 o address bus 54 b29 a1 o address bus 55 c28 a2 o address bus
11 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 56 c29 a3 o address bus 57 d28 vssq input/output power supply (0 v) 58 d29 a4 o address bus 59 e28 vccq input/output power supply (3.3 v) 60 e29 a5 o address bus 61 f28 a6 o address bus 62 f29 a7 o address bus 63 g28 a8 o address bus 64 g29 a9 o address bus 65 h28 a10 o address bus 66 h29 a11 o address bus 67 j28 a12 o address bus 68 j29 a13 o address bus 69 k28 vssq input/output power supply (0 v) 70 k29 a14 o address bus 71 l28 vccq input/output power supply (3.3 v) 72 l29 a15 o address bus 73 m28 a16 o address bus 74 m29 a17 o address bus 75 n28 a18 o address bus 76 n29 a19 o address bus 77 p28 a20 o address bus 78 p29 a21 o address bus 79 r28 vss power supply (0 v) 80 r29 a22 o address bus 81 t28 vcc power supply (1.9 v/1.8 v * 5 ) 82 t29 a23 o address bus 83 u28 vssq input/output power supply (0 v) 84 u29 a24 o address bus 85 v28 vccq input/output power supply (3.3 v)
12 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 86 v29 a25 o address bus 87 w28 bs /ptk[4] o / i/o bus cycle start signal / input/output port k 88 w29 rd o read strobe 89 y28 we0 /dqmll o d7Cd0 select signal / dqm (sdram) 90 y29 we1 /dqmlu/ we o d15Cd8 select signal / dqm (sdram) / write strobe (pcmcia) 91 aa28 we2 /dqmul/ iciord / ptk[6] o / i/o d23Cd16 select signal / dqm (sdram) / pcmcia / input/output port read / input/output port k 92 aa29 we3 /dqmuu/ iciowr / ptk[7] o / i/o d31Cd24 select signal / dqm (sdram) / pcmcia / input/output port read / / input/output port k 93 ab28 rd/ wr o read/write 94 ab29 audsync /pte[7] o / i/o aud synchronous / input/output port e 95 ac28 vssq input/output power supply (0 v) 96 ac29 cs0 / mcs[0] o chip select 0/mask rom chip select 0 97 ad28 vccq input/output power supply (3.3 v) 98 ad29 cs2 /ptk[0] o / i/o chip select 2 / input/output port k 99 ae28 cs3 /ptk[1] o / i/o chip select 3 / input/output port k 100 ae29 cs4 /ptk[2] o / i/o chip select 4 / input/output port k 101 af28 cs5 / ce1a /ptk[3] o / i/o chip select 5/ce1 (area 5 pcmcia) / input/output port k 102 af29 cs6 / ce1b o chip select 6/ce1 (area 6 pcmcia) / input/output port k 103 ag28 ce2a /pte[4] o / i/o area 5 pcmcia card enable / input/output port e 104 ag29 ce2b /pte[5] o / i/o area 6 pcmcia card enable / input/output port e 105 ah28 cke/ptk[5] o / i/o ck enable (sdram) / input/output port k
13 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 106 aj28 ras3l /ptj[0] o / i/o lower 32 mbytes address (area 3 dram, sdram) ras / input/output port j 107 ah27 ras2l / ptj[1] o / i/o lower 32 mbytes address (area 2 dram, sdram) ras / input/output port j 108 aj27 casll /casl/ptj[2] o / i/o d7Cd0 (dram) cas / lower 32 mbytes address (sdram) cas / input/output port j 109 ah26 vssq input/output power supply (0 v) 110 aj26 caslh /casu/ptj[3] o / i/o d15Cd8 (dram) cas / lower 32 mbytes address (sdram) cas / input/output port j 111 ah25 vccq input/output power supply (3.3 v) 112 aj25 cashl /ptj[4] o / i/o d23Cd16 (dram) cas / input/output port j 113 ah24 cashh /ptj[5] o / i/o d31Cd24 (dram) cas / input/output port j 114 aj24 dack0/ptd[5] o / i/o dma acknowledge 0 / input/output port d 115 ah23 dack1/ptd[7] o / i/o dma acknowledge 1 / input/output port d 116 aj23 cas2l/ pte[6] o / i/o d7Cd0 (area 2 dram) cas / input/output port e 117 ah22 cas2h/ pte[3] o / i/o d15Cd8 (area 2 dram) cas / input/output port e 118 aj22 ras3u /pte[2] o / i/o upper 32 mbytes address (area 3 dram, sdram) ras / input/output port e 119 ah21 ras2u /pte[1] o / i/o upper 32 mbytes address (area 2 dram) ras / input/output port e 120 aj21 tdo/pte[0] i/o test data output / input/output port e 121 ah20 back o bus acknowledge 122 aj20 breq i bus request 123 ah19 wait i hardware wait request 124 aj19 resetm i manual reset request
14 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 125 ah18 adtrg /pth[5] i analog trigger / input port h 126 aj18 iois16 /ptg[7] i area 6 16-bit input/output / input port g 127 ah17 asemd0 /ptg[6] * 6 i ase mode / input port g 128 aj17 asebrkak /ptg[5] o/i ase break acknowledge / input port g 129 ah16 ptg[4] i input port g 130 aj16 audata[3]/ptg[3] i/o / i aud data / input port g 131 ah15 audata[2]/ptg[2] i/o / i aud data / input port g 132 aj15 vss power supply (0 v) 133 ah14 audata[1]/ptg[1] i/o / i aud data / input port g 134 aj14 vcc power supply (1.9v/1.8 v * 5 ) 135 ah13 audata[0]/ptg[0] i/o / i aud data / input port g 136 aj13 trst /ptf[7]/pint[15] i test reset / input port f / port interrupt 137 ah12 tms/ptf[6]/pint[14] i test mode switch / input port f / port interrupt 138 aj12 tdi/ptf[5]/pint[13] i test data input / input port f / port interrupt 139 ah11 tck/ptf[4]/pnt[12] i test clock / input port f / port interrupt 140 aj11 irls [3]/ptf[3]/ pint[11] i external interrupt request / input port f / port interrupt 141 ah10 irls [2]/ptf[2]/ pint[10] i external interrupt request / input port f / port interrupt 142 aj10 irls [1]/ptf[1]/pint[9] i external interrupt request / input port f / port interrupt 143 ah09 irls [0]/ptf[0]/pint[8] i external interrupt request / input port f / port interrupt 144 aj09 md0 i clock mode setting 145 ah08 vcc-pll1 * 2 pll1 power supply (1.9v/1.8 v * 5 ) 146 aj08 cap1 pll1 external capacitance pin 147 ah07 vss-pll1 * 2 pll1 power supply (0 v) 148 aj07 vss-pll2 * 2 pll2 power supply (0 v)
15 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 149 ah06 cap2 pll2 external capacitance pin 150 aj06 vcc-pll2 * 2 pll2 power supply (1.9v/1.8 v * 5 ) 151 ah05 audck/pth[6] i aud clock / input port h 152 aj05 vss power supply (0 v) 153 ah04 vss power supply (0 v) 154 aj04 vcc power supply (1.9v/1.8 v * 5 ) 155 ah03 xtal o clock oscillator pin 156 aj03 extal i external clock / crystal oscillator pin 157 ah02 status0/ptj[6] o / i/o processor status / input/output port j 158 ah01 status1/ptj[7] o / i/o processor status / input/output port j 159 ag02 tclk/pth[7] i/o tmu or rtc clock input/output / input/output port h 160 ag01 irqout o interrupt request notification 161 af02 vssq power supply (0 v) 162 af01 ckio i/o system clock input/output 163 ae02 vccq power supply (3.3 v) 164 ae01 txd0/scpt[0] o transmit data 0 / sci output port 165 ad02 sck0/scpt[1] i/o serial clock 0 / sci input/output port 166 ad01 txd1/scpt[2] o transmit data 1 / sci output port 167 ac02 sck1/scpt[3] i/o serial clock 1 / sci input/output port 168 ac01 txd2/scpt[4] o transmit data 2 / sci output port 169 ab02 sck2/scpt[5] i/o serial clock 2 / sci input/output port 170 ab01 rts2 /scpt[6] o / i/o transmit request 2 / sci input/output port 171 aa02 rxd0/scpt[0] i receive data 0 / sci output port 172 aa01 rxd1/scpt[2] i receive data 1 / sci output port 173 y02 vss power supply (0 v) 174 y01 rxd2/scpt[4] i receive data 2 / sci output port
16 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 175 w02 vcc power supply (1.9v/1.8 v * 5 ) 176 w01 cts2 /irq5/scpt[7] i transmit clear 2 / external interrupt request / sci input port 177 v02 mcs[7] /ptc[7]/pint[7] o / i/o / i mask rom chip select / input/output port c / port interrupt 178 v01 mcs[6] /ptc[6]/pint[6] o / i/o / i mask rom chip select / input/output port c / port interrupt 179 u02 mcs[5] /ptc[5]/pint[5] o / i/o / i mask rom chip select / input/output port c / port interrupt 180 u01 mcs[4] /ptc[4]/pint[4] o / i/o / i mask rom chip select / input/output port c / port interrupt 181 t02 vssq input/output power supply (0 v) 182 t01 wakeup /ptd[3] o / i/o standby mode interrupt request notification / input/output port d 183 r02 vccq input/output power supply (3.3 v) 184 r01 resetout /ptd[2] o / i/o reset output / input/output port d 185 p02 mcs[3] /ptc[3]/pint[3] o / i/o / i mask rom chip select / input/output port c / port interrupt 186 p01 mcs[2] /ptc[2]/pint[2] o / i/o / i mask rom chip select / input/output port c / port interrupt 187 n02 mcs[1] /ptc[1]/pint[1] o / i/o / i mask rom chip select / input/output port c / port interrupt 188 n01 mcs[0] /ptc[0]/pint[0] o / i/o / i mask rom chip select / input/output port c / port interrupt 189 m02 drak0/ptd[1] o / i/o dma request acknowledge / input/output port d 190 m01 drak1/ptd[0] o / i/o dma request acknowledge / input/output port d 191 l02 dreq0 /ptd[4] i dma request / input port d 192 l01 dreq1 /ptd[6] i dma request / input port d 193 k02 resetp i power-on reset request 194 k01 ca i chip activate / hardware standby request 195 j02 md3 i area 0 bus width setting 196 j01 md4 i area 0 bus width setting
17 table 1.3 sh7709a pin function (cont) number of pins fp-208c tbt-216b pin name i/o description 197 h02 md5 i endian setting 198 h01 avss analog power supply (0 v) 199 g02 an[0]/ptl[0] i a/d converter input / input port l 200 g01 an[1]/ptl[1] i a/d converter input / input port l 201 f02 an[2]/ptl[2] i a/d converter input / input port l 202 f01 an[3]/ptl[3] i a/d converter input / input port l 203 e02 an[4]/ptl[4] i a/d converter input / input port l 204 e01 an[5]/ptl[5] i a/d converter input / input port l 205 d02 avcc (3.3v) analog power supply (3.3 v) 206 d01 an[6]/da[1]/ptl[6] i a/d converter input / d/a converter output / input port l 207 c02 an[7]/da[0]/ptl[7] i a/d converter input / d/a converter output / input port l 208 c01 avss analog power supply (0 v) notes: 1. must be connected to the power supply even when the rtc is not used. 2. must be connected to the power supply even when the on-chip pll circuits are not used (except in hardware standby mode). 3. except in hardware standby mode, all v cc /v ss pins must be connected to the system power supply. (supply power constantly.) in hardware standby mode, power must be supplied at least to v cc Crtc and v ss Crtc. if power is not supplied to v cc and v ss pins other than v cc Crtc and v ss Crtc, hold the ca pin low. 4. a01, a28, a29, ah29, aj29, aj02, aj01, and b01 are nc pins. do not make any connection to these pins. 5. 1.9 v for the 133 mhz model, 1.8 v for the 100 mhz model 6. drive high when using the user system alone, and not using an emulator or the h-udi.
18
19 section 2 cpu 2.1 register configuration 2.1.1 privileged mode and banks processor modes: there are two processor modes: user mode and privileged mode. the sh7709a normally operates in user mode, and enters privileged mode when an exception occurs or an interrupt is accepted. there are three kinds of registersgeneral registers, system registers, and control registersand the registers that can be accessed differ in the two processor modes. general registers: there are 16 general registers, designated r0 to r15. general registers r0 to r7 are banked registers which are switched by a processor mode change. in privileged mode, the register bank bit (rb) in the status register (sr) defines which banked register set is accessed as general registers, and which set is accessed only through the load control register (ldc) and store control register (stc) instructions. when the rb bit is 1, bank1 general registers r0_bank1Cr7_bank1 and non-banked general registers r8Cr15 function as the general register set, with bank0 general registers r0_bank0Cr7_bank0 accessed only by the ldc/stc instructions. when the rb bit is 0, bank0 general registers r0_bank0Cr7_bank0 and nonbanked general registers r8Cr15 function as the general register set, with bank1 general registers r0_bank1C r7_bank1 accessed only by the ldc/stc instructions. in user mode, the 16 registers comprising bank 0 general registers r0_bank0Cr7_bank0 and non-banked registers r8Cr15 can be accessed as general registers r0Cr15, and bank 1 general registers r0_bank1C r7_bank1 cannot be accessed. control registers: control registers comprise the global base register (gbr) and status register (sr) which can be accessed in both processor modes, and the saved status register (ssr), saved program counter (spc), and vector base register (vbr) which can only be accessed in privileged mode. some bits of the status register (such as the rb bit) can only be accessed in privileged mode. system registers: system registers comprise the multiply and accumulate registers (macl/mach), the procedure register (pr), and the program counter (pc). access to these registers does not depend on the processor mode. the register configuration in each mode is shown in figures 2.1 and 2.2. switching between user mode and privileged mode is controlled by the processor mode bit (md) in the status register.
20 31 0 r0 _ bank0 * 1, * 2 r1 _ bank0 * 2 r2 _ bank0 * 2 r3 _ bank0 * 2 r4 _ bank0 * 2 r5 _ bank0 * 2 r6 _ bank0 * 2 r7 _ bank0 * 2 r8 r9 r10 r11 r12 r13 r14 r15 sr gbr mach macl pr pc user mode register configuration notes: * 1 * 2 r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. banked register figure 2.1 user mode register configuration
21 r0_bank1 * 1 , * 2 r1_bank1 * 2 r2_bank1 * 2 r3_bank1 * 2 r4_bank1 * 2 r5_bank1 * 2 r6_bank1 * 2 r7_bank1 * 2 r8 r9 r10 r11 r12 r13 r14 r15 sr ssr pc spc gbr mach macl pr vbr 31 0 a. privileged mode register configuration (rb = 1) r0_bank0 * 1 , * 3 r1_bank0 * 3 r2_bank0 * 3 r3_bank0 * 3 r4_bank0 * 3 r5_bank0 * 3 r6_bank0 * 3 r7_bank0 * 3 r0_bank0 * 1 , * 3 r1_bank0 * 3 r2_bank0 * 3 r3_bank0 * 3 r4_bank0 * 3 r5_bank0 * 3 r6_bank0 * 3 r7_bank0 * 3 r8 r9 r10 r11 r12 r13 r14 r15 sr ssr pc spc gbr mach macl pr vbr 31 0 b. privileged mode register configuration (rb = 0) r0_bank1 * 1 , * 2 r1_bank1 * 2 r2_bank1 * 2 r3_bank1 * 2 r4_bank1 * 2 r5_bank1 * 2 r6_bank1 * 2 r7_bank1 * 2 notes: * 1 * 2 * 3 r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr- indirect addressing mode. banked register when the rb bit of the sr register is 1, the register can be accessed for general use. when the rb bit is 0, it can only be accessed with the ldc/stc instruction. banked register when the rb bit of the sr register is 0, the register can be accessed for general use. when the rb bit is 1, it can only be accessed with the ldc/stc instruction. figure 2.2 privileged mode register configuration
22 register values after a reset are shown in table 2.1. table 2.1 initial register values type registers initial value general registers r0 to r15 undefined control registers sr md bit = 1, rb bit = 1, bl bit = 1, i3C i0 = 1111 (h'f), reserved bits = 0, others undefined gbr, ssr, spc undefined vbr h'00000000 system registers mach, macl, pr undefined pc h'a0000000 2.1.2 general registers there are 16 general registers, designated r0 to r15 (figure 2.3). general registers r0 to r7 are banked registers, with a different r0Cr7 register bank (r0_bank0Cr7_bank0 or r0_bank1Cr7_bank1) being accessed according to the processor mode. for details, see figure 2.1 user mode register configulation and figure 2.2 privileged mode register configulation. the general register configuration is shown in table 2.2. 31 0 r0 * 1, * 2 general registers notes: r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. in some instructions, only r0 can be used as the source register or destination register. r0Cr7 are banked registers. in privileged mode, sr.rb specifies which banked registers are accessed as general registers (r0_bank0Cr7_bank0 or r0_bank1Cr7_bank1). * 1 * 2 r1 * 2 r2 * 2 r3 * 2 r4 * 2 r5 * 2 r6 * 2 r7 * 2 r8 r9 r10 r11 r12 r13 r14 r15 figure 2.3 general registers
23 2.1.3 system registers system registers can be accessed by the lds and sts instructions. when an exception occurs, the contents of the program counter (pc) are saved in the saved program counter (spc). the spc contents are restored to the pc by the rte instruction used at the end of the exception handling. there are four system registers, as follows. ? multiply and accumulate high register (mach) ? multiply and accumulate low register (macl) ? procedure register (pr) ? program counter (pc) the system register configuration is shown in figure 2.4. 31 0 31 0 31 0 system registers multiply and accumulate high and low registers (mach/l) store the results of multiply-and-accumulate operations. procedure register (pr) stores the return address for exiting a subroutine procedure. program counter (pc) indicates the address four addresses (two instructions) ahead of the currently executing instruction. initialized to h'a0000000 by a reset. pr pc mach macl figure 2.4 system registers 2.1.4 control registers control registers can be accessed in privileged mode using the ldc and stc instructions. the gbr register can also be accessed in user mode. there are five control registers, as follows: ? status register (sr) ? saved status register (ssr) ? saved program counter (spc) ? global base register (gbr) ? vector base register (vbr)
24 ssr saved status register (ssr) stores current sr value at time of exception to indicate processor status in return to instruction stream from exception handler. saved program counter (spc) stores current pc value at time of exception to indicate return address at completion of exception handling. global base register (gbr) stores base address of gbr-indirect addressing mode. the gbr-indirect addressing mode is used for on-chip supporting module register area data transfers and logic operations. the gbr register can also be accessed in user mode. its contents are undefined after a reset. vector base register (vbr) stores base address of exception handling vector area. initialized to h'0000000 by a reset. 31 0 spc 31 0 gbr 31 0 vbr 31 0 md bl m q 0CCCCCCCCCCCCCCCCCCCCC0 i3 i2 i1 i0 0 0 s t status register (sr) 31 29 28 27 10 9 8 7 0 1 3 0rb 30 md: rb: bl: cl: m and q bits: i3Ci0 bits: s bit: t bit: 0 bits: processor operation mode bit: indicates the processor operation mode as follows: md =1: privileged mode; md = 0: user mode md is set to 1 on generation of an exception or interrupt , and is initialized to 1 by a reset. register bank bit: determines the bank of general registers r0Cr7 used in processing mode. rb = 1: r0_bank1Cr7_bank1 and r8Cr15 are general registers, and r0_bank0C r7_bank0 can be accessed by ldc/stc instructions. rb = 0: r0_bank0Cr7_bank0 and r8Cr15 are general registers, and r0_bank1C r7_bank1 can be accessed by ldc/stc instructions. rb is set to 1 on generation of an exception or interrupt , and is initialized to 1 by a reset. block bit bl = 1: exceptions and interrupts are suppressed. see section 4, exception handling, for details. bl = 0: exceptions and interrupts are accepted. bl is set to 1 on generation of an exception or interrupt , and is initialized to 1 by a reset. cache lock bit when set to 1, the cache lock function can be used. used by the div0s/u and div1 instructions. interrupt mask bits: 4-bit field indicating the interrupt request mask level. i3Ci0 do not change to the interrupt acceptance level when an interrupt is generated. initialized to b'1111 by a reset. used by the mac instruction. used by the movt, cmp/cond, tas, tst, bt, bf, sett, clrt, and dt instructions to indicate true (1) or false (0). used by the addv/c, subv/c, div0u/s, div1, negc, shar/l, shlr/l, rotr/l, and rotcr/l instructions to indicate a carry, borrow, overflow, or underflow. these bits always read 0, and the write value should always be 0. note: the m, q, s, and t bits can be set or cleared by special instructions in user mode. their values are undefined after a reset. all other bits can be read or written in privileged mode. 0 0 11 12 13 cl figure 2.5 register set overview, control registers
25 2.2 data formats 2.2.1 data format in registers register operands are always longwords (32 bits, figure 2.6). when a memory operand is only a byte (8 bits) or a word (16 bits), it is sign-extended into a longword when loaded into a register. longword 31 0 figure 2.6 longword 2.2.2 data format in memory memory data formats are classified into bytes, words, and longwords. memory can be accessed in 8-bit byte, 16-bit word, or 32-bit longword form. a memory operand less than 32 bits in length is sign-extended before being stored in a register. a word operand must be accessed starting from a word boundary (even address of a 2-byte unit: address 2n), and a longword operand starting from a longword boundary (even address of a 4-byte unit: address 4n). an address error will result if this rule is not observed. a byte operand can be accessed from any address. big-endian or little-endian byte order can be selected for the data format. the endian mode should be set with the md5 external pin in a power-on reset. big-endian mode is selected when the md5 pin is low, and little-endian when high. the endian mode cannot be changed dynamically. bit positions are numbered left to right from most-significant to least-significant. thus, in a 32-bit longword, the leftmost bit, bit 31, is the most significant bit and the rightmost bit, bit 0, is the least significant bit. the data format in memory is shown in figure 2.7. longwordlongword 31 0 15 23 7 byte0 byte1 byte2 byte3 word1 big-endian mode word0 address a + 4 address a + 8 address a + 4 address a address a address a + 1 address a + 3 31 0 15 23 7 byte3 byte2 byte1 byte0 word0 little-endian mode word1 address a + 11 address a + 10 address a + 8 address a address a + 8 address a + 9 address a + 2 figure 2.7 data format in memory
26 2.3 instruction features 2.3.1 execution environment data length: the sh7709a instruction set is implemented with fixed-length 16-bit wide instructions executed in a pipelined sequence with single-cycle execution for most instructions. all operations are executed in 32-bit longword units. memory can be accessed in 8-bit byte, 16-bit word, or 32-bit longword units, with byte or word units sign-extended into 32-bit longwords. literals are sign-extended in arithmetic operations (mov, add, and cmp/eq instructions) and zero-extended in logical operations (tst, and, or, and xor instructions). load/store architecture: the sh7709a features a load-store architecture in which basic operations are executed in registers. operations requiring memory access are executed in registers following register loading, except for bit-manipulation operations such as logical and functions, which are executed directly in memory. delayed branching: unconditional branching is implemented as delayed branch operations. pipeline disruptions due to branching are minimized by the execution of the instruction following the delayed branch instruction prior to branching. conditional branch instructions are of two kinds, delayed and normal. bra trget add r1, r0 ;add is executed prior to branching to trget
27 t bit: the t bit in the status register (sr) is used to indicate the result of compare operations, and is read as a true/false condition determining if a conditional branch is taken or not. to improve processing speed, the t bit logic state is modified only by specific operations. an example of how the t bit may be used in a sequence of operations is shown below. add #1, r0 ;t bit not modified by add operation cmp/eq r1, r0 ;t bit set to 1 when r0 = 0 bt trget ;branch taken to trget when t bit = 1 (r0 = 0) literals: byte-length literals are inserted directly into the instruction code as immediate data. to maintain the 16-bit fixed-length instruction code, word or longword literals are stored in a table in main memory rather than inserted directly into the instruction code. the memory table is accessed by the mov instruction using pc-relative addressing with displacement, as follows: mov.w @(disp, pc), r0 absolute addresses: as with word and longword literals, absolute addresses must also be stored in a table in main memory. the value of the absolute address is transferred to a register and the operand access is specified by indexed register-indirect addressing, with the absolute address loaded (like word and longword immediate data) during instruction execution. 16-bit and 32-bit displacements: in the same way, 16-bit and 32-bit displacements also must be stored in a table in main memory. exactly like absolute addresses, the displacement value is transferred to a register and the operand access is specified by indexed register-indirect addressing, loading the displacement (like word and longword immediate data) during instruction execution.
28 2.3.2 addressing modes addressing modes and effective address calculation methods are shown in table 2.2. table 2.2 addressing modes and effective addresses addressing mode instruction format effective address calculation method calculation formula register direct rn effective address is register rn. (operand is register rn contents.) register indirect @rn effective address is register rn contents. rn rn rn register indirect with post-increment @rn+ effective address is register rn contents. a constant is added to rn after instruction execution: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn rn 1/2/4 + rn + 1/2/4 rn after instruction execution byte: rn + 1 rn word: rn + 2 rn longword: rn + 4 rn register indirect with pre-decrement @Crn effective address is register rn contents, decremented by a constant beforehand: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn 1/2/4 rn C 1/2/4 C rn C 1/2/4 byte: rn C 1 rn word: rn C 2 rn longword: rn C 4 rn (instruction executed with rn after calculation)
29 table 2.2 addressing modes and effective addresses (cont) addressing mode instruction format effective address calculation method calculation formula register indirect with displacement @(disp:4, rn) effective address is register rn contents with 4-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. rn 1/2/4 + disp (zero-extended) rn + disp 1/2/4 byte: rn + disp word: rn + disp 2 longword: rn + disp 4 indexed register indirect @(r0, rn) effective address is sum of register rn and r0 contents. rn r0 rn + r0 + rn + r0 gbr indirect with displacement @(disp:8, gbr) effective address is register gbr contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. gbr 1/2/4 + disp (zero-extended) gbr + disp 1/2/4 byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4 indexed gbr indirect @(r0, gbr) effective address is sum of register gbr and r0 contents. gbr r0 gbr + r0 + gbr + r0
30 table 2.2 addressing modes and effective addresses (cont) addressing mode instruction format effective address calculation method calculation formula pc-relative with displacement @(disp:8, pc) effective address is register pc contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 2 (word), or 4 (longword), according to the operand size. with a longword operand, the lower 2 bits of pc are masked. pc h'fffffffc + 2/4 x & (for longword) disp (zero-extended) pc + disp 2 or pc&h'fffffffc + disp 4 word: pc + disp 2 longword: pc & h'ffff fffc + disp 4 pc-relative disp:8 effective address is register pc contents with 8-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2 disp:12 effective address is register pc contents with 12-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2
31 table 2.2 addressing modes and effective addresses (cont) addressing mode instruction format effective address calculation method calculation formula pc-relative rn effective address is sum of register pc and rn contents. pc r0 + pc + r0 pc + rn immediate #imm:8 8-bit immediate data imm of tst, and, or, or xor instruction is zero-extended. #imm:8 8-bit immediate data imm of mov, add, or cmp/eq instruction is sign-extended. #imm:8 8-bit immediate data imm of trapa instruction is zero-extended and multiplied by 4. note: for the addressing modes below that use a displacement (disp), the assembler descriptions in this manual show the value before scaling ( 1, 2, or 4) is performed according to the operand size. this is done to clarify the operation of the ic. refer to the relevant assembler notation rules for the actual assembler descriptions. @ (disp:4, rn) ; register indirect with displacement @ (disp:8, rn) ; gbr indirect with displacement @ (disp:8, pc) ; pc-relative with displacement disp:8, disp:12; pc-relative
32 2.3.3 instruction formats table 2.3 explains the meaning of instruction formats and source and destination operands. the meaning of the operands depends on the operation code. the following symbols are used. xxxx: operation code mmmm: source register nnnn: destination register iiii: immediate data dddd: displacement table 2.3 instruction formats instruction format source operand destination operand instruction example 0 format xxxx xxxx xxxx xxxx 15 0 nop n format xxxx xxxx xxxx nnnn 15 0 nnnn: register direct movt rn control register or system register nnnn: register direct sts mach,rn control register or system register nnnn: register indirect with pre-decrement stc.l sr,@Crn m format xxxx mmmm xxxx xxxx 15 0 mmmm: register direct control register or system register ldc rm,sr mmmm: register indirect with post- increment control register or system register ldc.l @rm+,sr mmmm: register indirect jmp @rm mmmm: pc- relative using rm braf rm
33 table 2.3 instruction formats (cont) instruction format source operand destination operand instruction example nm format nnnn xxxx xxxx 15 0 mmmm mmmm: register direct nnnn: register direct add rm,rn mmmm: register indirect nnnn: register indirect mov.l rm,@rn mmmm: register indirect with post- increment (multiply-and- accumulate operation) nnnn: * register indirect with post- increment (multiply-and- accumulate operation) mach,macl mac.w @rm+,@rn+ mmmm: register indirect with post- increment nnnn: register direct mov.l @rm+,rn mmmm: register direct nnnn: register indirect with pre-decrement mov.l rm,@Crn mmmm: register direct nnnn: indexed register indirect mov.l rm,@(r0,rn) md format xxxx dddd 15 0 mmmm xxxx mmmmdddd: register indirect with displacement r0 (register direct) mov.b @(disp,rm),r0 nd4 format dddd nnnn xxxx 15 0 xxxx r0 (register direct) nnnndddd: register indirect with displacement mov.b r0,@(disp,rn)
34 table 2.3 instruction formats (cont) instruction format source operand destination operand instruction example nmd format nnnn xxxx dddd 15 0 mmmm mmmm: register direct nnnndddd: register indirect with displacement mov.l rm,@(disp,rn) mmmmdddd: register indirect with displacement nnnn: register direct mov.l @(disp,rm),rn d format dddd xxxx 15 0 xxxx dddd dddddddd: gbr indirect with displacement r0 (register direct) mov.l @(disp,gbr),r0 r0 (register direct) dddddddd: gbr indirect with displacement mov.l r0,@(disp,gbr) dddddddd: pc-relative with displacement r0 (register direct) mova @(disp,pc),r0 dddddddd: pc-relative bf label d12 format dddd xxxx 15 0 dddd dddd dddddddddddd: pc-relative bra label (label = disp + pc) nd8 format dddd nnnn xxxx 15 0 dddd dddddddd: pc-relative with displacement nnnn: register direct mov.l @(disp,pc),rn i format i i i i xxxx 15 0 xxxx i i i i iiiiiiii: immediate indexed gbr indirect and.b #imm, @(r0,gbr) iiiiiiii: immediate r0 (register direct) and #imm,r0 iiiiiiii: immediate trapa #imm ni format nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: register direct add #imm,rn note: * in a multiply-and-accumulate instruction, nnnn is the source register.
35 2.4 instruction set 2.4.1 instruction set classified by function the sh7709a instruction set includes 68 basic instruction types, as listed in table 2.4. table 2.4 classification of instructions classification types operation code function no. of instructions data transfer 5 mov data transfer 39 mova effective address transfer movt t bit transfer swap swap of upper and lower bytes xtrct extraction of middle of linked registers arithmetic 21 add binary addition 33 operations addc binary addition with carry addv binary addition with overflow check cmp/condcomparison div1 division div0s initialization of signed division div0u initialization of unsigned division dmuls signed double-precision multiplication dmulu unsigned double-precision multiplication dt decrement and test exts sign extension extu zero extension mac multiply-and-accumulate operation, double-precision multiply-and-accumulate operation
36 table 2.4 classification of instructions (cont) classification types operation code function no. of instructions arithmetic operations 21 mul double-precision multiplication (32 32 bits) 33 (cont) muls signed multiplication (16 16 bits) mulu unsigned multiplication (16 16 bits) neg negation negc negation with borrow sub binary subtraction subc binary subtraction with borrow subv binary subtraction with underflow check logic 6 and logical and 14 operations not bit inversion or logical or tas memory test and bit set tst logical and and t bit set xor exclusive or shift 12 rotl one-bit left rotation 16 rotr one-bit right rotation rotcl one-bit left rotation with t bit rotcr one-bit right rotation with t bit shal one-bit arithmetic left shift shar one-bit arithmetic right shift shll one-bit logical left shift shlln n-bit logical left shift shlr one-bit logical right shift shlrn n-bit logical right shift shad dynamic arithmetic shift shld dynamic logical shift
37 table 2.4 classification of instructions (cont) classification types operation code function no. of instructions branch 9 bf conditional branch, delayed conditional branch (t = 0) 11 bt conditional branch, delayed conditional branch (t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure rts return from subroutine procedure system 15 clrmac mac register clear 75 control clrt clear t bit clrs clear s bit ldc load to control register lds load to system register ldtlb load pte to tlb nop no operation pref prefetch data to cache rte return from exception handling sets set s bit sett set t bit sleep shift to power-down mode stc store from control register sts store from system register trapa trap exception handling total: 68 188
38 table 2.5 lists the sh7709a instruction code formats. table 2.5 instruction code format item format explanation instruction mnemonic op.sz src,dest op: operation code sz: size src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement instruction code msb ? lsb mmmm: source register nnnn: destination register 0000: r0 0001: r1 ........... 1111: r15 iiii: immediate data dddd: displacement * operation summary , (xx) m/q/t & | ^ ~ <>n direction of transfer memory operand flag bits in sr logical and of each bit logical or of each bit exclusive or of each bit logical not of each bit n-bit shift privileged mode indicates whether privileged mode applies execution cycles value when no wait states are inserted the execution cycles listed in the table are minimums. the actual number of cycles may be increased in cases such as the followsing: 1. when contention occurs between instruction fetches and data access 2. when the destination register of the load instruction (memory register) and the register used by the next instruction are the same t bit value of t bit after instruction is executed : no change note: * scaling ( 1, 2, 4) is performed according to the instruction operand size.
39 table 2.6 lists the sh7709a data transfer instructions table 2.6 data transfer instructions instruction operation code privileged mode cycles t bit mov #imm,rn imm sign extension rn 1110nnnniiiiiiii 1 mov.w @(disp,pc),rn (disp 2 + pc) sign extension rn 1001nnnndddddddd 1 mov.l @(disp,pc),rn (disp 4 + pc) rn 1101nnnndddddddd 1 mov rm,rn rm rn 0110nnnnmmmm0011 1 mov.b rm,@rn rm (rn) 0010nnnnmmmm0000 1 mov.w rm,@rn rm (rn) 0010nnnnmmmm0001 1 mov.l rm,@rn rm (rn) 0010nnnnmmmm0010 1 mov.b @rm,rn (rm) sign extension rn 0110nnnnmmmm0000 1 mov.w @rm,rn (rm) sign extension rn 0110nnnnmmmm0001 1 mov.l @rm,rn (rm) rn 0110nnnnmmmm0010 1 mov.b rm,@ C rn rnC1 rn, rm (rn) 0010nnnnmmmm0100 1 mov.w rm,@ C rn rnC2 rn, rm (rn) 0010nnnnmmmm0101 1 mov.l rm,@ C rn rnC4 rn, rm (rn) 0010nnnnmmmm0110 1 mov.b @rm+,rn (rm) sign extension rn, rm + 1 rm 0110nnnnmmmm0100 1 mov.w @rm+,rn (rm) sign extension rn, rm + 2 rm 0110nnnnmmmm0101 1 mov.l @rm+,rn (rm) rn,rm + 4 rm 0110nnnnmmmm0110 1 mov.b r0,@(disp,rn) r0 (disp + rn) 10000000nnnndddd 1 mov.w r0,@(disp,rn) r0 (disp 2 + rn) 10000001nnnndddd 1 mov.l rm,@(disp,rn) rm (disp 4 + rn) 0001nnnnmmmmdddd 1 mov.b @(disp,rm),r0 (disp + rm) sign extension r0 10000100mmmmdddd 1 mov.w @(disp,rm),r0 (disp 2 + rm) sign extension r0 10000101mmmmdddd 1 mov.l @(disp,rm),rn (disp 4 + rm) rn 0101nnnnmmmmdddd 1 mov.b rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0100 1
40 table 2.6 data transfer instructions (cont) instruction operation code privileged mode cycles t bit mov.w rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0101 1 mov.l rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0110 1 mov.b @(r0,rm),rn (r0 + rm) sign extension rn 0000nnnnmmmm1100 1 mov.w @(r0,rm),rn (r0 + rm) sign extension rn 0000nnnnmmmm1101 1 mov.l @(r0,rm),rn (r0 + rm) rn 0000nnnnmmmm1110 1 mov.b r0,@(disp,gbr) r0 (disp + gbr) 11000000dddddddd 1 mov.w r0,@(disp,gbr) r0 (disp 2 + gbr) 11000001dddddddd 1 mov.l r0,@(disp,gbr) r0 (disp 4 + gbr) 11000010dddddddd 1 mov.b @(disp,gbr),r0 (disp + gbr) sign extension r0 11000100dddddddd 1 mov.w @(disp,gbr),r0 (disp 2 + gbr) sign extension r0 11000101dddddddd 1 mov.l @(disp,gbr),r0 (disp 4 + gbr) r0 11000110dddddddd 1 mova @(disp,pc),r0 disp 4 + pc r0 11000111dddddddd 1 movt rn t rn 0000nnnn00101001 1 swap.b rm,rn rm swap the bottom two bytes reg 0110nnnnmmmm1000 1 swap.w rm,rn rm swap two consecutive words rn 0110nnnnmmmm1001 1 xtrct rm,rn rm: middle 32 bits of rn rn 0010nnnnmmmm1101 1
41 table 2.7 lists the sh7709a arithmetic instructions. table 2.7 arithmetic instructions instruction operation code privileged mode cycles t bit add rm,rn rn + rm rn 0011nnnnmmmm1100 1 add #imm,rn rn + imm rn 0111nnnniiiiiiii 1 addc rm,rn rn + rm + t rn, carry t 0011nnnnmmmm1110 1 carry addv rm,rn rn + rm rn, overflow t 0011nnnnmmmm1111 1 overflow cmp/eq #imm,r0 if r0 = imm, 1 t 10001000iiiiiiii 1 comparison result cmp/eq rm,rn if rn = rm, 1 t 0011nnnnmmmm0000 1 comparison result cmp/hs rm,rn if rn rm with unsigned data, 1 t 0011nnnnmmmm0010 1 comparison result cmp/ge rm,rn if rn rm with signed data, 1 t 0011nnnnmmmm0011 1 comparison result cmp/hi rm,rn if rn > rm with unsigned data, 1 t 0011nnnnmmmm0110 1 comparison result cmp/gt rm,rn if rn > rm with signed data, 1 t 0011nnnnmmmm0111 1 comparison result cmp/pz rn if rn 0, 1 t 0100nnnn00010001 1 comparison result cmp/pl rn if rn > 0, 1 t 0100nnnn00010101 1 comparison result cmp/str rm,rn if rn and rm have an equivalent byte, 1 t 0010nnnnmmmm1100 1 comparison result div1 rm,rn single-step division (rn/rm) 0011nnnnmmmm0100 1 calculation result div0s rm,rn msb of rn q, msb of rm m, m ^ q t 0010nnnnmmmm0111 1 calculation result div0u 0 m/q/t 0000000000011001 10
42 table 2.7 arithmetic instructions (cont) instruction operation code privileged mode cycles t bit dmuls.l rm,rn signed operation of rn rm mach, macl 32 32 64 bits 0011nnnnmmmm1101 2(5) * dmulu.l rm,rn unsigned operation of rn rm mach, macl 32 32 64 bits 0011nnnnmmmm0101 2(5) * dt rn rn C 1 rn, if rn = 0, 1 t, else 0 t 0100nnnn00010000 1 comparison result exts.b rm,rn a byte in rm is sign- extended rn 0110nnnnmmmm1110 1 exts.w rm,rn a word in rm is sign- extended rn 0110nnnnmmmm1111 1 extu.b rm,rn a byte in rm is zero- extended rn 0110nnnnmmmm1100 1 extu.w rm,rn a word in rm is zero- extended rn 0110nnnnmmmm1101 1 mac.l @rm+,@rn+ signed operation of (rn) (rm) + mac mac, rn + 4 rn, rm + 4 rm 32 32 + 64 64 bits 0000nnnnmmmm1111 2(5) * mac.w @rm+,@rn+ signed operation of (rn) (rm) + mac mac, rn + 2 rn, rm + 2 rm 16 16 + 64 64 bits 0100nnnnmmmm1111 2(5) * mul.l rm,rn rn rm macl 32 32 32 bits 0000nnnnmmmm0111 2(5) * muls.w rm,rn signed operation of rn rm mac 16 16 32 bits 0010nnnnmmmm1111 1(3) * mulu.w rm,rn unsigned operation of rn rm mac 16 16 32 bits 0010nnnnmmmm1110 1(3) *
43 table 2.7 arithmetic instructions (cont) instruction operation code privileged mode cycles t bit neg rm,rn 0Crm rn 0110nnnnmmmm1011 1 negc rm,rn 0CrmCt rn, borrow t 0110nnnnmmmm1010 1 borrow sub rm,rn rnCrm rn 0011nnnnmmmm1000 1 subc rm,rn rnCrmCt rn, borrow t 0011nnnnmmmm1010 1 borrow subv rm,rn rnCrm rn, underflow t 0011nnnnmmmm1011 1 underflow note: * the normal number of execution cycles is shown. the value in parentheses is the number of cycles required in case of contention with the preceding or following instruction.
44 table 2.8 lists the sh7709a logic operation instructions. table 2.8 logic operation instructions instruction operation code privileged mode cycles t bit and rm,rn rn & rm rn 0010nnnnmmmm1001 1 and #imm,r0 r0 & imm r0 11001001iiiiiiii 1 and.b #imm,@(r0,gbr) (r0 + gbr) & imm (r0 + gbr) 11001101iiiiiiii 3 not rm,rn ~rm rn 0110nnnnmmmm0111 1 or rm,rn rn | rm rn 0010nnnnmmmm1011 1 or #imm,r0 r0 | imm r0 11001011iiiiiiii 1 or.b #imm,@(r0,gbr) (r0 + gbr) | imm (r0 + gbr) 11001111iiiiiiii 3 tas.b @rn if (rn) is 0, 1 t; 1 msb of (rn) 0100nnnn00011011 3 test result tst rm,rn * rn & rm; if the result is 0, 1 t 0010nnnnmmmm1000 1 test result tst #imm,r0 r0 & imm; if the result is 0, 1 t 11001000iiiiiiii 1 test result tst.b #imm,@(r0,gbr) (r0 + gbr) & imm; if the result is 0, 1 t 11001100iiiiiiii 3 test result xor rm,rn rn ^ rm rn 0010nnnnmmmm1010 1 xor #imm,r0 r0 ^ imm r0 11001010iiiiiiii 1 xor.b #imm,@(r0,gbr) (r0 + gbr) ^ imm (r0 + gbr) 11001110iiiiiiii 3 note: * an on-chip dmac bus cycle is not inserted between a tas instruction operand read cycle and write cycle. also, bus release is not performed by breq.
45 table 2.9 lists the sh7709a shift instructions. table 2.9 shift instructions instruction operation code privileged mode cycles t bit rotl rn t rn msb 0100nnnn00000100 1 msb rotr rn lsb rn t 0100nnnn00000101 1 lsb rotcl rn t rn t 0100nnnn00100100 1 msb rotcr rn t rn t 0100nnnn00100101 1 lsb shad rm,rn rn 0: rn << rm rn rn < 0: rn >> rm [msb rn] 0100nnnnmmmm1100 1 shal rn t rn 0 0100nnnn00100000 1 msb shar rn msb rn t 0100nnnn00100001 1 lsb shld rm,rn rn 0: rn << rm rn rn < 0: rn >> rm [0 rn] 0100nnnnmmmm1101 1 shll rn t rn 0 0100nnnn00000000 1 msb shlr rn 0 rn t 0100nnnn00000001 1 lsb shll2 rn rn << 2 rn 0100nnnn00001000 1 shlr2 rn rn >> 2 rn 0100nnnn00001001 1 shll8 rn rn << 8 rn 0100nnnn00011000 1 shlr8 rn rn >> 8 rn 0100nnnn00011001 1 shll16 rn rn << 16 rn 0100nnnn00101000 1 shlr16 rn rn >> 16 rn 0100nnnn00101001 1
46 table 2.10 lists the sh7709a branch instructions. table 2.10 branch instructions instruction operation code privileged mode cycles t bit bf label if t = 0, disp 2 + pc pc; if t = 1, nop (where label is disp + pc) 10001011dddddddd 3/1 * bf/s label delayed branch, if t = 0, disp 2 + pc pc; if t = 1, nop 10001111dddddddd 2/1 * bt label delayed branch, if t = 1, disp 2 + pc pc; if t = 0, nop 10001001dddddddd 3/1 * bt/s label if t = 1, disp 2 + pc pc; if t = 0, nop 10001101dddddddd 2/1 * bra label delayed branch, disp 2 + pc pc 1010dddddddddddd 2 braf rm delayed branch, rm + pc pc 0000mmmm00100011 2 bsr label delayed branch, pc pr, disp 2 + pc pc 1011dddddddddddd 2 bsrf rm delayed branch, pc pr, rm + pc pc 0000mmmm00000011 2 jmp @rm delayed branch, rm pc 0100mmmm00101011 2 jsr @rm delayed branch, pc pr, rm pc 0100mmmm00001011 2 rts delayed branch, pr pc 0000000000001011 2 note: * one state when there is no branch.
47 table 2.11 lists the sh7709a system control instructions. table 2.11 system control instructions instruction operation code privileged mode cycles t bit clrmac 0 mach, macl 0000000000101000 1 clrs 0 s 0000000001001000 1 clrt 0 t 0000000000001000 10 ldc rm,sr rm sr 0100mmmm00001110 5 lsb ldc rm,gbr rm gbr 0100mmmm00011110 1 ldc rm,vbr rm vbr 0100mmmm00101110 1 ldc rm,ssr rm ssr 0100mmmm00111110 1 ldc rm,spc rm spc 0100mmmm01001110 1 ldc rm,r0_bank rm r0_bank 0100mmmm10001110 1 ldc rm,r1_bank rm r1_bank 0100mmmm10011110 1 ldc rm,r2_bank rm r2_bank 0100mmmm10101110 1 ldc rm,r3_bank rm r3_bank 0100mmmm10111110 1 ldc rm,r4_bank rm r4_bank 0100mmmm11001110 1 ldc rm,r5_bank rm r5_bank 0100mmmm11011110 1 ldc rm,r6_bank rm r6_bank 0100mmmm11101110 1 ldc rm,r7_bank rm r7_bank 0100mmmm11111110 1 ldc.l @rm+,sr (rm) sr, rm + 4 rm 0100mmmm00000111 7 lsb ldc.l @rm+,gbr (rm) gbr, rm + 4 rm 0100mmmm00010111 1 ldc.l @rm+,vbr (rm) vbr, rm + 4 rm 0100mmmm00100111 1 ldc.l @rm+,ssr (rm) ssr, rm + 4 rm 0100mmmm00110111 1 ldc.l @rm+,spc (rm) spc, rm + 4 rm 0100mmmm01000111 1 ldc.l @rm+, r0_bank (rm) r0_bank, rm + 4 rm 0100mmmm10000111 1 ldc.l @rm+, r1_bank (rm) r1_bank, rm + 4 rm 0100mmmm10010111 1 ldc.l @rm+, r2_bank (rm) r2_bank, rm + 4 rm 0100mmmm10100111 1 ldc.l @rm+, r3_bank (rm) r3_bank, rm + 4 rm 0100mmmm10110111 1
48 table 2.11 system control instructions (cont) instruction operation code privileged mode cycles t bit ldc.l @rm+, r4_bank (rm) r4_bank, rm + 4 rm 0100mmmm11000111 1 ldc.l @rm+, r5_bank (rm) r5_bank, rm + 4 rm 0100mmmm11010111 1 ldc.l @rm+, r6_bank (rm) r6_bank, rm + 4 rm 0100mmmm11100111 1 ldc.l @rm+, r7_bank (rm) r7_bank, rm + 4 rm 0100mmmm11110111 1 lds rm,mach rm mach 0100mmmm00001010 1 lds rm,macl rm macl 0100mmmm00011010 1 lds rm,pr rm pr 0100mmmm00101010 1 lds.l @rm+,mach (rm) mach, rm + 4 rm 0100mmmm00000110 1 lds.l @rm+,macl (rm) macl, rm + 4 rm 0100mmmm00010110 1 lds.l @rm+,pr (rm) pr, rm + 4 rm 0100mmmm00100110 1 ldtlb pteh/ptel tlb 0000000000111000 1 nop no operation 0000000000001001 1 pref @rm (rm) cache 0000mmmm10000011 1 rte delayed branch, ssr/spc sr/pc 0000000000101011 4 sets 1 s 0000000001011000 1 sett 1 t 0000000000011000 11 sleep sleep 0000000000011011 4 * stc sr,rn sr rn 0000nnnn00000010 1 stc gbr,rn gbr rn 0000nnnn00010010 1 stc vbr,rn vbr rn 0000nnnn00100010 1 stc ssr,rn ssr rn 0000nnnn00110010 1 stc spc,rn spc rn 0000nnnn01000010 1 stc r0_bank,rn r0_bank rn 0000nnnn10000010 1 stc r1_bank,rn r1_bank rn 0000nnnn10010010 1 stc r2_bank,rn r2_bank rn 0000nnnn10100010 1 stc r3_bank,rn r3_bank rn 0000nnnn10110010 1 note: * the number of cycles until the sleep state is entered.
49 table 2.11 system control instructions (cont) instruction operation code privileged mode cycles t bit stc r4_bank,rn r4_bank rn 0000nnnn11000010 1 stc r5_bank,rn r5_bank rn 0000nnnn11010010 1 stc r6_bank,rn r6_bank rn 0000nnnn11100010 1 stc r7_bank,rn r7_bank rn 0000nnnn11110010 1 stc.l sr,@ C rn rnC4 rn, sr (rn) 0100nnnn00000011 1 stc.l gbr,@ C rn rnC4 rn, gbr (rn) 0100nnnn00010011 1 stc.l vbr,@ C rn rnC4 rn, vbr (rn) 0100nnnn00100011 1 stc.l ssr,@ C rn rnC4 rn, ssr (rn) 0100nnnn00110011 1 stc.l spc,@ C rn rnC4 rn, spc (rn) 0100nnnn01000011 1 stc.l r0_bank, @ C rn rnC4 rn, r0_bank (rn) 0100nnnn10000011 2 stc.l r1_bank, @ C rn rnC4 rn, r1_bank (rn) 0100nnnn10010011 2 stc.l r2_bank, @ C rn rnC4 rn, r2_bank (rn) 0100nnnn10100011 2 stc.l r3_bank, @ C rn rnC4 rn, r3_bank (rn) 0100nnnn10110011 2 stc.l r4_bank, @ C rn rnC4 rn, r4_bank (rn) 0100nnnn11000011 2 stc.l r5_bank, @ C rn rnC4 rn, r5_bank (rn) 0100nnnn11010011 2 stc.l r6_bank, @ C rn rnC4 rn, r6_bank (rn) 0100nnnn11100011 2 stc.l r7_bank, @ C rn rnC4 rn, r7_bank (rn) 0100nnnn11110011 2 sts mach,rn mach rn 0000nnnn00001010 1 sts macl,rn macl rn 0000nnnn00011010 1 sts pr,rn pr rn 0000nnnn00101010 1 sts.l mach,@ C rn rnC4 rn, mach (rn) 0100nnnn00000010 1 sts.l macl,@ C rn rnC4 rn, macl (rn) 0100nnnn00010010 1 sts.l pr,@ C rn rnC4 rn, pr (rn) 0100nnnn00100010 1 trapa #imm pc spc, sr ssr, imm tra 11000011iiiiiiii 6
50 notes: 1. the table shows the minimum number of execution cycles. the actual number of instruction execution cycles will increase in cases such as the following: ? when there is contention between an instruction fetch and data access ? when the destination register in a load (memory-to-register) instruction is also used by the next instruction 2. with the addressing modes using displacement (disp) listed below, the assembler descriptions in this manual show the value before scaling ( 1, 2, or 4) is performed. this is done to clarify the operation of the chip. for the actual assembler descriptions, refer to the individual assembler notation rules. @ (disp:4, rn) ; register-indirect with displacement @ (disp:8, rn) ; gbr-indirect with displacement @ (disp:8, pc) ; pc-relative with displacement disp:8, disp:12 ; pc-relative
51 2.4.2 instruction code map table 2.12 shows the instruction code map. table 2.12 instruction code map instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0000 rn fx 0000 0000 rn fx 0001 0000 rn 00md 0010 stc sr,rn stc gbr,rn stc vbr,rn stc ssr,rn 0000 rn 01md 0010 stc spc,rn 0000 rn 10md 0010 stc r0_bank,rn stc r1_bank,rn stc r2_bank,rn stc r3_bank,rn 0000 rn 11md 0010 stc r4_bank,rn stc r5_bank,rn stc r6_bank,rn stc r7_bank,rn 0000 rm 00md 0011 bsrf rm braf rm 0000 rn 10md 0011 pref @rn 0000 rn rm 01md mov.b rm,@(r0,rn) mov.w rm,@(r0,rn) mov.l rm,@(r0,rn) mul.l rm,rn 0000 0000 00md 1000 clrt sett clrmac ldtlb 0000 0000 01md 1000 clrs sets 0000 0000 fx 1001 nop div0u 0000 0000 fx 1010 0000 0000 fx 1011 rts sleep rte 0000 rn fx 1000 0000 rn fx 1001 movt rn 0000 rn fx 1010 sts mach,rn sts macl,rn sts pr,rn 0000 rn fx 1011 0000 rn rm 11md mov.b @(r0,rm),rn mov.w @(r0,rm),rn mov.l @(r0,rm),rn mac.l @rm+,@rn+ 0001 rn rm disp mov.l rm,@(disp:4,rn) 0010 rn rm 00md mov.b rm,@rn mov.w rm,@rn mov.l rm,@rn 0010 rn rm 01md mov.b rm,@-rn mov.w rm,@-rn mov.l rm,@-rn div0s rm,rn 0010 rn rm 10md tst rm,rn and rm,rn xor rm,rn or rm,rn 0010 rn rm 11md cmp/str rm,rn xtrct rm,rn mulu.w rm,rn mulsw rm,rn 0011 rn rm 00md cmp/eq rm,rn cmp/hs rm,rn cmp/ge rm,rn 0011 rn rm 01md div1 rm,rn dmulu.lrm,rn cmp/hi rm,rn cmp/gt rm,rn 0011 rn rm 10md sub rm,rn subc rm,rn subv rm,rn 0011 rn rm 11md add rm,rn dmuls.lrm,rn addc rm,rn addv rm,rn
52 table 2.12 instruction code map (cont) instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0100 rn fx 0000 shll rn dt rn shal rn 0100 rn fx 0001 shlr rn cmp/pz rn shar rn 0100 rn fx 0010 sts.l mach,@-rn sts.l macl,@-rn sts.l pr,@-rn 0100 rn 00md 0011 stc.l sr,@-rn stc.l gbr,@-rn stc.l vbr,@-rn stc.l ssr,@-rn 0100 rn 01md 0011 stc.l spc,@-rn 0100 rn 10md 0011 stc.l r0_bank,@-rn stc.l r1_bank,@-rn stc.l r2_bank,@-rn stc.l r3_bank,@-rn 0100 rn 11md 0011 stc.l r4_bank,@-rn stc.l r5_bank,@-rn stc.l r6_bank,@-rn stc.l r7_bank,@-rn 0100 rn fx 0100 rotl rn rotcl rn 0100 rn fx 0101 rotr rn cmp/pl rn rotcr rn 0100 rm fx 0110 lds.l @rm+,mach lds.l @rm+,macl lds.l @rm+,pr 0100 rm 00md 0111 ldc.l @rm+,sr ldc.l @rm+,gbr ldc.l @rm+,vbr ldc.l @rm+,ssr 0100 rm 01md 0111 ldc.l @rm+,spc 0100 rm 10md 0111 ldc.l @rm+,r0_bank ldc.l @rm +, r1_bank ldc.l @rm+,r2_bank ldc.l @rm+,r3_bank 0100 rm 11md 0111 ldc.l @rm+,r4_bank ldc.l @rm+,r5_bank ldc.l @rm+,r6_bank ldc.l @rm+,r7_bank 0100 rn fx 1000 shll2 rn shll8 rn shll16 rn 0100 rn fx 1001 shlr2 rn shlr8 rn shlr16 rn 0100 rm fx 1010 lds rm,mach lds rm,macl lds rm,pr 0100 rm/ rn fx 1011 jsr @rm tas.b @rn jmp @rm 0100 rn rm 1100 shad rm,rn 0100 rn rm 1101 shld rm,rn 0100 rm 00md 1110 ldc rm,sr ldc rm,gbr ldc rm,vbr ldc rm,ssr 0100 rm 01md 1110 ldc rm,spc 0100 rm 10md 1110 ldc rm,r0_bank ldc rm,r1_bank ldc rm,r2_bank ldc rm,r3_bank 0100 rm 11md 1110 ldc rm,r4_bank ldc rm,r5_bank ldc rm,r6_bank ldc rm,r7_bank 0100 rn rm 1111 mac.w @rm+,@rn+ 0101 rn rm disp mov.l @(disp:4,rm),rn 0110 rn rm 00md mov.b @rm,rn mov.w @rm,rn mov.l @rm,rn mov rm,rn 0110 rn rm 01md mov.b @rm+,rn mov.w @rm+,rn mov.l @rm+,rn not rm,rn 0110 rn rm 10md swap.b rm,rn swap.w rm,rn negc rm,rn neg rm,rn 0110 rn rm 11md extu.b rm,rn extu.w rm,rn exts.b rm,rn exts.w rm,rn 0111 rn imm add #imm:8,rn
53 table 2.12 instruction code map (cont) instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 1000 00md rn disp mov.b r0,@(disp:4,rn) mov.w r0,@(disp:4,rn) 1000 01md rm disp mov.b @(disp:4,rm),r0 mov.w @(disp:4,rm),r0 1000 10md imm/disp cmp/eq #imm:8,r0 bt label:8 bf label:8 1000 11md imm/disp bt/s label:8 bf/s label:8 1001 rn disp mov.w @(disp:8,pc),rn 1010 disp bra label:12 1011 disp bsr label:12 1100 00md imm/disp mov.b r0,@(disp:8,gbr) mov.w r0,@(disp:8,gbr) mov.l r0,@(disp:8,gbr) trapa #imm:8 1100 01md disp mov.b @(disp:8,gbr),r0 mov.w @(disp:8,gbr),r0 mov.l @(disp:8,gbr),r0 mova @(disp:8,pc),r0 1100 10md imm tst #imm:8,r0 and #imm:8,r0 xor #imm:8,r0 or #imm:8,r0 1100 11md imm tst.b #imm:8,@(r0,gbr) and.b #imm:8,@(r0,gbr) xor.b #imm:8,@(r0,gbr) or.b #imm:8,@(r0,gbr) 1101 rn disp mov.l @(disp:8,pc),rn 1110 rn imm mov #imm:8,rn 1111 ************ note: see the sh-3/sh-3e/sh3-dsp programming manual for details.
54 2.5 processor states and processor modes 2.5.1 processor states the sh7709a has five processor states: the reset state, exception-handling state, bus-released state, program execution state, and power-down state. reset state: in this state the cpu is reset. the cpu enters the power-on reset state if the resetp pin is low, or the manual reset state if the resetm pin is low. see section 4, exception handling, for more information on resets. in the power-on reset state, the internal states of the cpu and the on-chip supporting module registers are initialized. in the manual reset state, the internal states of the cpu and registers of on- chip supporting modules other than the bus state controller (bsc) are initialized. since the bsc is not initialized in the manual reset state, refreshing operations continue. refer to the register configurations in the relevant sections for further details. exception-handling state: this is a transient state during which the cpus processor state flow is altered by a reset, general exception, or interrupt exception handling. in the case of a reset, the cpu branches to address h'a0000000 and starts executing the user- coded exception handling program. in the case of a general exception or interrupt, the program counter (pc) contents are saved in the saved program counter (spc) and the status register (sr) contents are saved in the saved status register (ssr). the cpu branches to the start address of the user-coded exception service routine found from the sum of the contents of the vector base address and the vector offset. see section 4, exception processing, for more information on resets, general exceptions, and interrupts. program execution state: in this state the cpu executes program instructions in sequence. power-down state: in the power-down state, cpu operation halts and power consumption is reduced. there are three modes in the power-down state: sleep mode, standby mode and hardware standby mode. see section 8, power-down modes, for more information. bus-released state: in this state the cpu has released the bus to a device that requested it. transitions between the states are shown in figure 2.8.
55 from any state when resetp = 0 from any state but hardware standby mode when resetm = 0 note: * the hardware standb y mode is entered when the ca p in g oes low from an y state. resetp = 1 resetm = 1 resetp = 0 ca = 1, resetp =0 power-on reset state manual reset state program execution state bus-released state sleep mode standby mode hardware standby mode * exception-handling state interrupt bus request bus request clearance exception interrupt end of exception transition processing bus request bus request clearance sleep instruction with stby bit set interrupt reset state power-down state sleep instruction with stby bit cleared bus request b u s re q u e s t c le a ra n c e figure 2.8 processor state transitions 2.5.2 processor modes there are two processor modes: privileged mode and user mode. the processor mode is determined by the processor mode bit (md) in the status register (sr). user mode is selected when the md bit is 0, and privileged mode when the md bit is 1. when the reset state or exception state is entered, the md bit is set to 1. when exception handling ends, the md bit is cleared to 0 and user mode is entered. there are certain registers and bits which can only be accessed in privileged mode.
56
57 section 3 memory management unit (mmu) 3.1 overview 3.1.1 features the sh7709a has an on-chip memory management unit (mmu) that implements address translation. the sh7709a features a resident translation look-aside buffer (tlb) that caches information for user-created address translation tables located in external memory. it enables high- speed translation of virtual addresses into physical addresses. address translation uses the paging system and supports two page sizes (1 kbytes and 4 kbytes). the access right to virtual address space can be set for privileged and user modes to provide memory protection. 3.1.2 role of mmu the mmu is a feature designed to make efficient use of physical memory. as shown in figure 3.1, if a process is smaller in size than the physical memory, the entire process can be mapped onto physical memory. however, if the process increases in size to the extent that it no longer fits into physical memory, it becomes necessary to partition the process and to map those parts requiring execution onto memory as occasion demands ((1)). having the process itself consider this mapping onto physical memory would impose a large burden on the process. to lighten this burden, the idea of virtual memory was born as a means of performing en bloc mapping onto physical memory ((2)). in a virtual memory system, substantially more virtual memory than physical memory is provided, and the process is mapped onto this virtual memory. thus a process only has to consider operation in virtual memory. mapping from virtual memory to physical memory is handled by the mmu. the mmu is normally controlled by the operating system, switching physical memory to allow the virtual memory required by a process to be mapped onto physical memory in a smooth fashion. switching of physical memory is carried out via secondary storage, etc. the virtual memory system that came into being in this way is particularly effective in a time- sharing system (tss) in which a number of processes are running simultaneously ((3)). if processes running in a tss had to take mapping onto virtual memory into consideration while running, it would not be possible to increase efficiency. virtual memory is thus used to reduce this load on the individual processes and so improve efficiency ((4)). in the virtual memory system, virtual memory is allocated to each process. the task of the mmu is to perform efficient mapping of these virtual memory areas onto physical memory. it also has a memory protection feature that prevents one process from inadvertently accessing another processs physical memory. when address translation from virtual memory to physical memory is performed using the mmu, it may occur that the relevant translation information is not recorded in the mmu, with the result that one process may inadvertently access the virtual memory allocated to another process. in this
58 case, the mmu will generate an exception, change the physical memory mapping, and record the new address translation information. although the functions of the mmu could also be implemented by software alone, the need for translation to be performed by software each time a process accesses physical memory would result in poor efficiency. for this reason, a buffer for address translation (translation look-aside buffer: tlb) is provided in hardware to hold frequently used address translation information. the tlb can be described as a cache for storing address translation information. unlike cache memory, however, if address translation fails, that is, if an exception is generated, switching of address translation information is normally performed by software. this makes it possible for memory management to be performed flexibly by software. the mmu has two methods of mapping from virtual memory to physical memory: a paging method using fixed-length address translation, and a segment method using variable-length address translation. with the paging method, the unit of translation is a fixed-size address space (usually of 1 to 64 kbytes) called a page. in the following text, the sh7709a address space in virtual memory is referred to as virtual address space, and address space in physical memory as physical memory space.
59 process 1 physical memory mmu (1) (2) (3) (4) process 1 physical memory process 1 virtual memory mmu physical   

 
  
 memory process 1 process 2 process 3 virtual memory physical   figure 3.1 mmu functions
60 3.1.3 sh7709a mmu virtual address map: the sh7709a uses 32-bit virtual addresses to access a 4-gbyte virtual address space that is divided into several areas. address space mapping is shown in figure 3.2. (a) in privileged mode, there are five areas, p0Cp4. the p0 and p3 areas are mapped onto physical address space in page units, in accordance with address translation table information. write- back or write-through can be selected for write access by means of a ccr setting. mapping of the p1 area is fixed to physical address space (h'00000000 to h'1fffffff). in the p1 area, setting a virtual address msbs (bit 31) to 0 generates the corresponding physical address. p1 area access can be cached, and the cache control register (ccr) is set to indicate whether to cache or not. write access is processed as write-through. write-back or write- through can be selected. mapping of the p2 area is fixed to physical address space (h'00000000 to h'1fffffff). in the p2 area, setting the top three virtual address bits (bits 31, 30, and 29) to 0 generates the corresponding physical address. p2 area access cannot be cached. the p1 and p2 areas are not mapped by the address translation table, so the tlb is not used and no exceptions like tlb misses occur. initialization of mmu-related registers, exception processing, and the like are located in the p1 and p2 areas. because the p1 area is cached, handlers that require high-speed processing are placed there. a part of the control register in the peripheral module is allocated in area 1 of the physical address space. when the physical address space is not used for address translation, allocate that part of the control register in the p2 area. when the physical address space is used for address translation, set no caching. the p4 area is used for mapping on-chip control register addresses. addresses h'e0000000 to h'efffffff and h'f4000000 to h'fbffffff are reserved areas. operation is not guaranteed if these areas are accessed. cache is allocated to addresses h'f0000000 to h'f1ffffff, and the tlb to addresses h'f2000000 to h'f3ffffff. addresses h'fc000000 to h'ffffffff are control register space. operation is not guaranteed if an address to which a control register is not allocated is accessed. (b) in the user mode, 2 gbytes of the virtual address space from h'00000000 to h'7fffffff (area u0) can be accessed. u0 is mapped onto physical address space in page units. write-back or write-through mode can be selected for write accesses by means of a ccr setting. 2 gbytes of the virtual address space from h'80000000 to h'ffffffff cannot be accessed in the user mode. attempting to do so creates an address error. write-back or write-through can be selected for write access by means of a ccr setting.
61 h'80000000 h'a0000000 h'c0000000 h'e0000000 h'ffffffff 2-gbyte virtual space, cacheable (write-back/write-through) 2-gbyte virtual space, cacheable (write-back/write-through) address error h'00000000 h'00000000 h'80000000 h'ffffffff area p0 area p1 area p2 area p3 area p4 area u0 privileged mode user mode 0.5-gbyte fixed physical space, cacheable (write-back/write-through) 0.5-gbyte fixed physical space, non-cacheable 0.5-gbyte virtual space, cacheable (write-back/write-through) 0.5-gbyte control space, non-cacheable figure 3.2 virtual address space mapping
62 physical address space: the sh7709a supports a 32-bit physical address space, but the upper 3 bits are actually ignored and treated as a shadow. see section 10, bus state controller (bsc), for details. single address translation: when the mmu is enabled, the virtual address space is divided into units called pages. physical addresses are translated in page units. address translation tables in external memory hold information such as the physical address that corresponds to the virtual address and memory protection codes. when an access to areas p1 or p2 occurs, there is no tlb access and the physical address is defined uniquely by hardware. if it belongs to area p0, p3 or u0, the tlb is searched by virtual address and, if that virtual address is registered in the tlb, the access hits the tlb. the corresponding physical address and the page control information are read from the tlb and the physical address is determined. if the virtual address is not registered in the tlb, a tlb miss exception occurs and processing will shift to the tlb miss handler. in the tlb miss handler, the tlb address translation table in external memory is searched and the corresponding physical address and the page control information are registered in the tlb. after returning from the handler, the instruction that caused the tlb miss is re-executed. when the mmu is enabled, address translation information that results in a physical address space of h'80000000Ch'ffffffff should not be registered in the tlb. when the mmu is disabled, the virtual address is used directly as the physical address. as the sh7709a supports a 29-bit address space as the physical address space, the top 3 bits of the physical address are ignored, and constitute a shadow space (see section 10, bus state controller (bsc)). for example, addresses h'00001000 in the p0 area, h'80001000 in the p1 area, h'a0001000 in the p2 area, and h'c0001000 in the p3 area are all mapped onto the same physical address. when access to these addresses is performed with the cache enabled, an address with the top 3 bits of the physical address masked to 0 is stored in the cache address array to ensure data congruity. single virtual memory mode and multiple virtual memory mode: there are two virtual memory modes: single virtual memory mode and multiple virtual memory mode. in single virtual memory mode, multiple processes run in parallel using the virtual address space exclusively and the physical address corresponding to a given virtual address is specified uniquely. in multiple virtual memory mode, multiple processes run in parallel sharing the virtual address space, so a given virtual address may be translated into different physical addresses depending on the process. by the value set to the mmu control register (mmucr), either single or multiple virtual mode is selected. in terms of operation, the only difference between single virtual memory mode and multiple virtual memory mode is in the tlb address comparison method (see section 3.3.3, tlb address comparison).
63 address space identifier (asid): in multiple virtual memory mode, the address space identifier (asid) is used to differentiate between processes running in parallel and sharing virtual address space. the asid is 8 bits in length and can be set by software setting of the asid of the currently running process in pteh within the mmu. when the process is switched using the asid, the tlb does not have to be purged. in single virtual memory mode, the asid is used to provide memory protection for processes running simulataneously and using the virtual address space exclusively (see section 3.4.2, mmu software management). 3.1.4 register configuration a register that has an undefined initial value must be initialized by software. table 3.1 shows the configuration of the mmu control registers. table 3.1 register configuration name abbreviation r/w size initial value * 1 address page table entry register high pteh r/w longword undefined h'fffffff0 page table entry register low ptel r/w longword undefined h'fffffff4 translation table base register ttb r/w longword undefined h'fffffff8 tlb exception address register tea r/w longword undefined h'fffffffc mmu control register mmucr r/w longword * 2 h'ffffffe0 notes: * 1 initialized by a power-on reset or manual reset. * 2 sv bit: undefined other bits: 0
64 3.2 register description there are five registers for mmu processing. these are all peripheral module registers, so they are located in address space area p4 and can only be accessed from privileged mode by specifying the address. these registers consist of: 1.the page table entry register high (pteh) register residing at address h'fffffff0, which consists of a virtual page number (vpn) and asid. the vpn set is the vpn of the virtual address at which the exception is generated in case of an mmu exception or address error exception. when the page size is 4 kbytes, the vpn is the upper 20 bits of the virtual address, but in this case the upper 22 bits of the virtual address are set. the vpn can also be modified by software. as the asid, software sets the number of the currently executing process. the vpn and asid are recorded in the tlb by the ldtlb instruction. 2.the page table entry register low (ptel) register residing at address h'fffffff4, and used to store the physical page number and page management information to be recorded in the tlb by the ldtlb instruction. the contents of this register are only modified in response to a software command. 3.the translation table base register (ttb) residing at address h'fffffff8, which points to the base address of the current page table. the hardware does not set any value in ttb automatically. ttb is available to software for general purposes. 4.the tlb exception address register (tea) residing at address h'fffffffc, which stores the virtual address corresponding to a tlb or address error exception. this value remains valid until the next exception or interrupt. 5.the mmu control register (mmucr) residing at address h'ffffffe0, which makes the mmu settings described in figure 3.3. any program that modifies mmucr should reside in the p1 or p2 area.
65 the mmu registers are shown in figure 3.3. 31 7 vpn pteh ptel asid 0 ppn 0 10 31 6 4 3 2 1 0 10 31 ttb ttb 0 31 virtual address causing tlb-related or address error exception tea 0 pr sz c d 8 9 7 v 0 0 sh 0 mmucr 0 31 8 4 65 73210 sv rc 00 0 tf ix at 0: reserved bits. always read as 0. writing is ignored. however, 0 should also be specified in a write to mmucr only. sv: single virtual memory mode bit. set to 1 for the single virtual memory mode, cleared to 0 for the multiple virtual memory mode. rc: a 2-bit random counter, automatically updated by hardware according to the following rules in the event of an mmu exception. when a tlb miss exception occurs, all tlb entry ways corresponding to the virtual address at which the exception occurred are checked, and if all ways are valid, 1 is added to rc; if there is one or more invalid way, they are set by priority from way 0, in the order: way 0, way 1, way 2, way 3. in the event of an mmu exception other than a tlb miss exception, the way which caused the exception is set in rc. tf: tlb flush bit. write 1 to flush the tlb (clear all valid bits of the tlb to 0). always reads 0. ix: index mode bit. when 0, vpn bits 16C12 are used as the tlb index number. when 1, the value obtained by ex-oring asid bits 4C0 in pteh and vpn bits 16C12 are used as the tlb index number. at: address translation bit. enables/disables the mmu. 0: mmu disabled 1: mmu enabled figure 3.3 mmu register contents
66 3.3 tlb functions 3.3.1 configuration of the tlb the tlb caches address translation table information located in the external memory. the address translation table stores the physical page number translated from the virtual page number and the control information for the page, which is the unit of address translation. figure 3.4 shows the overall tlb configuration. the tlb is 4-way set associative with 128 entries. there are 32 entries for each way. figure 3.5 shows the configuration of virtual addresses and tlb entries. entry 1 address arra y data arra y entry 0 entry 1 entry 31 way 0C3 way 0C3 vpn(11C10) vpn(31C17) asid(7C0) v entry 0 entry 31 ppn(31C10) pr(1C0) sz c d sh figure 3.4 overall configuration of the tlb
67 31 9 vpn virtual address (1-kbyte page) virtual address (4-kbyte page) tlb entry offset vpn vpn (31C17) vpn (11C10) asid sh sz v pr ppn c d offset 0 10 31 11 0 (15) (2) (2) (22) (8) (1) (1) (1) (1) (1) 12 vpn: virtual page number. top 22 bits of virtual address for a 1-kbyte page, or top 20 bits of virtual address for a 4-kbyte page. since vpn bits 16-12 are used as the index number, they are not stored in the tlb entry. asid: address space identifier. indicates the process that can access a virtual page. in single virtual memory mode and user mode, or in multiple virtual memory mode, if the sh bit is 0, the address is compared with the asid in pteh when address comparison is performed. sh: share status bit 0 = page not shared between processes 1 = page shared between processes sz: page-size bit 0 = 1-kbyte page 1 = 4-kbyte page v: valid bit. indicates whether entry is valid. 0 = invalid 1 = valid cleared to 0 by a power-on reset. not affected by a manual reset. ppn: physical page number. top 22 bits of physical address. ppn bits 11-10 are not used in case of a 4-kbyte page. attention must be paid to the synonym problem in case of a 1-kbyte page (see section 3.4.4). pr: set the most significant bit to 0. protection key field. 2-bit field encoded to define the access rights to the page. 00: reading only is possible in privileged mode. 01: reading/writing is possible in privileged mode. 10: reading only is possible in privileged/user mode. 11: reading/writing is possible in privileged/user mode. c: cacheable bit. indicates whether the page is cacheable. 0: non-cacheable 1: cacheable d: dirty bit. indicates whether the page has been written to. 0 = not written to 1 = written to legend: figure 3.5 virtual address and tlb structure
68 3.3.2 tlb indexing the tlb uses a 4-way set associative scheme, so entries must be selected by index. vpn bits 16 to 12 are used as the index number regardless of the page size. the index number can be generated in two different ways depending on the setting of the ix bit in mmucr. 1.when ix = 0, vpn bits 16C12 alone are used as the index number 2.when ix = 1, vpn bits 16C12 are ex-ored with asid bits 4C0 to generate a 5-bit index number the second method is used to prevent lowered tlb efficiency that results when multiple processes run simultaneously in the same virtual address space (multiple virtual memory) and a specific entry is selected by indexing of each process. figures 3.6 and 3.7 show the indexing schemes. 31 16 11 12 17 0 31 0 pteh register virtual address vpn 0 asid 7 10 index asid(4C0) exclusive-or way 0C3 vpn(31C17) vpn(11C10) asid(7C0) v 0 31 address array data array ppn(31C10) pr(1C0) sz c d sh figure 3.6 tlb indexing (ix = 1)
69 31 16 11 12 17 0 virtual address way 0C3 vpn(31C17) vpn(11C10) asid(7C0) v 0 address arra y data arra y ppn(31C10) pr(1C0) sz c d sh index 31 figure 3.7 tlb indexing (ix = 0) 3.3.3 tlb address comparison the results of address comparison determine whether a specific virtual page number is registered in the tlb. the virtual page number of the virtual address that accesses external memory is compared to the virtual page number of the indexed tlb entry. the asid within the pteh is compared to the asid of the indexed tlb entry. all four ways are searched simultaneously. if the compared values match, and the indexed tlb entry is valid (v bit = 1), the hit is registered. it is necessary to have software ensure that tlb hits do not occur simultaneously in more than one way, as hardware operation is not guaranteed if this occurs. for example, if there are two identical tlb entries with the same vpn and a setting is made such that a tlb hit is made only by a process with asid = h'ff when one is in the shared state (sh = 1) and the other in the non-shared state (sh = 0), then if the asid in pteh is set to h'ff, there is a possibility of simultaneous tlb hits in both these ways. it is therefore necessary to ensure that this kind of setting is not made by software. the object compared varies depending on the page management information (sz, sh) in the tlb entry. it also varies depending on whether the system supports multiple virtual memory or single virtual memory. the page-size information determines whether vpn (11C10) is compared. vpn (11C10) is compared for 1-kbyte pages (sz = 0) but not for 4-kbyte pages (sz = 1).
70 the sharing information (sh) determines whether the pteh.asid and the asid in the tlb entry are compared. asids are compared when there is no sharing between processes (sh = 0) but not when there is sharing (sh = 1). when single virtual memory is supported (mmucr.sv = 1) and privileged mode is engaged (sr.md = 1), all process resources can be accessed. this means that asids are not compared when single virtual memory is supported and privileged mode is engaged. the objects of address comparison are shown in figure 3.8. bits compared: vpn (31C17) vpn (11C10) sz = 0? yes no yes (1 kbyte) no (4 kbytes) bits compared: vpn (31C17) bits compared: vpn (31C17) vpn (11C10) asid (7C0) sz = 0? yes (1 kbyte) no (4 kbytes) bits compared: vpn (31C17) asid (7C0) sh = 1 or (sr.md = 1 and mmucr.sv = 1)? figure 3.8 objects of address comparison
71 3.3.4 page management information in addition to the sh and sz bits, the page management information of tlb entries also includes d, c, and pr bits. the d bit of a tlb entry indicates whether the page is dirty (i.e., has been written to). if the d bit is 0, an attempt to write to the page results in an initial page write exception. for physical page swapping between secondary memory and main memory, for example, pages are controlled so that a dirty page is paged out of main memory only after that page is written back to secondary memory. to record that there has been a write to a given page in the address translation table in memory, an initial page write exception is used. the c bit in the entry indicates whether the referenced page resides in a cacheable or non- cacheable area of memory. when the control register in area 1 is mapped, set the c bit to 0. the pr field specifies the access rights for the page in privileged and user modes and is used to protect memory. attempts at nonpermitted accesses result in tlb protection violation exceptions. access states designated by the d, c, and pr bits are shown in table 3.2. table 3.2 access states designated by d, c, and pr bits privileged mode user mode reading writing reading writing d bit 0 permitted initial page write exception permitted initial page write exception 1 permitted permitted permitted permitted c bit 0 permitted (no caching) permitted (no caching) permitted (no caching) permitted (no caching) 1 permitted (with caching) permitted (with caching) permitted (with caching) permitted (with caching) pr bit 00 permitted tlb protection violation exception tlb protection violation exception tlb protection violation exception 01 permitted permitted tlb protection violation exception tlb protection violation exception 10 permitted tlb protection violation exception permitted tlb protection violation exception 11 permitted permitted permitted permitted
72 3.4 mmu functions 3.4.1 mmu hardware management there are two kinds of mmu hardware management as follows: 1.the mmu decodes the virtual address accessed by a process and performs address translation by controlling the tlb in accordance with the mmucr settings. 2.in address translation, the mmu receives page management information from the tlb, and determines the mmu exception and whether the cache is to be accessed (using the c bit). for details of the determination method and the hardware processing, see section 3.5, mmu exceptions. 3.4.2 mmu software management there are three kinds of mmu software management, as follows. 1.mmu register setting. mmucr setting, in particular, should be performed in areas p1 and p2 for which address translation is not performed. also, since sv and ix bit changes constitute address translation system changes, in this case, tlb flushing should be performed by simultaneously writing 1 to the tf bit also. since mmu exceptions are not generated in the mmu disabled state with the at bit cleared to 0, use in the disabled state must be avoided with software that does not use the mmu. 2.tlb entry recording, deletion, and reading. tlb entry recording can be done in two ways by using the ldtlb instruction, or by writing directly to the memory-mapped tlb. for tlb entry deletion and reading, the memory allocation tlb can be accessed. see section 3.4.3, mmu instruction (ldtlb), for details of the ldtlb instruction, and section 3.6, memory- mapped tlb configuration, for details of the memory-mapped tlb. 3.mmu exception processing. when an mmu exception is generated, it is handled on the basis of information set from the hardware side. see section 3.5, mmu exceptions, for details. when single virtual memory mode is used, it is possible to create a state in which physical memory access is enabled in the privileged mode only by clearing the share status bit (sh) to 0 to specify recording of all tlb entries. this strengthens inter-process memory protection, and enables special access levels to be created in the privileged mode only. recording a 1-kbyte page tlb entry may result in a synonym problem. see section 3.4.4, avoiding synonym problems.
73 3.4.3 mmu instruction (ldtlb) the load tlb instruction (ldtlb) is used to record tlb entries. when the ix bit in mmucr is 0, the ldtlb instruction changes the tlb entry in the way specified by the rc bit in mmucr to the value specified by pteh and ptel, using vpn bits 16C12 specified in pteh as the index number. when the ix bit in mmucr is 1, the ex-or of vpn bits 16C12 specified in pteh and asid bits 4C0 in pteh are used as the index number. figure 3.9 shows the case where the ix bit in mmucr is 0. when an mmu exception occurs, the virtual page number of the virtual address that caused the exception is set in pteh by hardware. the way is set in the rc bit of mmucr for each exception according to the rules shown in figure 3.9. consequently, if the ldtlb instruction is issued after setting only ptel in the mmu exception processing routine, tlb entry recording is possible. any tlb entry can be updated by software rewriting of pteh and the rc bits in mmucr. as the ldtlb instruction changes address translation information, there is a risk of destroying address translation information if this instruction is issued in the p0, u0, or p3 area. make sure, therefore, that this instruction is issued in the p1 or p2 area. also, an instruction associated with an access to the p0, u0, or p3 area (such as the rte instruction) should be issued at least two instructions after the ldtlb instruction.
74 vpn(31C17) vpn(11C10) asid(7C0) v vpn 0 asid vpn 0 sv 0 0 rc 0 tf ix at ppn 0 v 0 pr sz c d sh 0 write ppn(31C10) pr(1C0) sz c d sh write data array address array way selection way 0 to 3 31 9 0 mmucr index 31 17 12 10 8 0 pteh register 31 10 0 ptel register 0 31 figure 3.9 operation of ldtlb instruction
75 3.4.4 avoiding synonym problems when a 1-kbyte page is recorded in a tlb entry, a synonym problem may arise. if a number of virtual addresses are mapped onto a single physical address, the same physical address data will be recorded in a number of cache entries, and it will not be possible to guarantee data congruity. the reason why this problem only occurs when using a 1-kbyte page is explained below with reference to figure 3.10. to achieve high-speed operation of the sh7709a cache, an index number is created using virtual address bits 10C4. when a 4-kbyte page is used, virtual address bits 10C4 are included in the offset, and since they are not subject to address translation, they are the same as physical address bits 10C4. in cache-based address comparison and recording in the address array, since the cache tag address is a physical address, physical address bits 31C10 are recorded. when a 1-kbyte page is used, also, a cache index number is created using virtual address bits 10-4. however, in case of a 1-kbyte page, virtual address bit 10 is subject to address translation and therefore may not be the same as physical address bit 10. consequently, the physical address is recorded in a different entry from that of the index number indicated by the physical address in the cache address array. for example, assume that, with 1-kbyte page tlb entries, tlb entries for which the following translation has been performed are recorded in two tlbs: virtual address 1 h'00000000 physical address h'00000400 virtual address 2 h'00000400 physical address h'00000400 virtual address 1 is recorded in cache entry h'00, and virtual address 2 in cache entry h'40. since two virtual addresses are recorded in different cache entries despite the fact that the physical addresses are the same, memory inconsistency will occur as soon as a write is performed to either virtual address. therefore, when recording a 1-kbyte tlb entry, if the physical address is the same as a physical address already used in another tlb entry, it should be recorded in such a way that physical address bit 10 is the same.
76 when using a 4-kbyte page virtual address 31 vpn 0 12 11 10 offset physical address 31 ppn 0 offset virtual address (11C4) physical address (31C10) cache address array when using a 1-kbyte page virtual address 31 vpn 0 10 11 offset physical address 31 ppn 0 10 11 offset virtual address (11C4) physical address (31C10) cache address array 9 9 12 11 10 figure 3.10 synonym problem
77 3.5 mmu exceptions there are four mmu exceptions: tlb miss, tlb protection violation, tlb invalid, and initial page write. 3.5.1 tlb miss exception a tlb miss results when the virtual address and the address array of the selected tlb entry are compared and no match is found. tlb miss exception processing includes both hardware and software operations. hardware operations: in a tlb miss, the sh7709a hardware executes a set of prescribed operations, as follows: 1.the vpn field of the virtual address causing the exception is written to the pteh register. 2.the virtual address causing the exception is written to the tea register. 3.either exception code h'040 for a load access, or h'060 for a store access, is written to the expevt register. 4.the pc value indicating the address of the instruction in which the exception occurred is written to the save program counter (spc). if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written to the spc. 5.the contents of the status register (sr) at the time of the exception are written to the save status register (ssr). 6.the mode (md) bit in sr is set to 1 to place the sh7709a in the privileged mode. 7.the block (bl) bit in sr is set to 1 to mask any further exception requests. 8.the register bank (rb) bit in sr is set to 1. 9.the rc field in the mmu control register (mmucr) is incremented by 1 when all entries indexed are valid. when some entries indexed are invalid, the smallest way number of them is set in rc. 10.execution branches to the address obtained by adding the value of the vbr contents and h'00000400 to invoke the user-written tlb miss exception handler. software (tlb miss handler) operations: the software searches the page tables in external memory and allocates the required page table entry. upon retrieving the required page table entry, software must execute the following operations: 1.write the value of the physical page number (ppn) field and the protection key (pr), page size (sz), cacheable (c), dirty (d), share status (sh), and valid (v) bits of the page table entry recorded in the address translation table in the external memory into the ptel register in the sh7709a.
78 2.if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 3.issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 4.issue the return from exception handler (rte) instruction to terminate the handler routine and return to the instruction stream. 3.5.2 tlb protection violation exception a tlb protection violation exception results when the virtual address and the address array of the selected tlb entry are compared and a valid entry is found to match, but the type of access is not permitted by the access rights specified in the pr field. tlb protection violation exception processing includes both hardware and software operations. hardware operations: in a tlb protection violation exception, the sh7709a hardware executes a set of prescribed operations, as follows: 1.the vpn field of the virtual address causing the exception is written to the pteh register. 2.the virtual address causing the exception is written to the tea register. 3.either exception code h'0a0 for a load access, or h'0c0 for a store access, is written to the expevt register. 4.the pc value indicating the address of the instruction in which the exception occurred is written into spc (if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written into spc). 5.the contents of sr at the time of the exception are written to ssr. 6.the md bit in sr is set to 1 to place the sh7709a in the privileged mode. 7.the bl bit in sr is set to 1 to mask any further exception requests. 8.the register bank (rb) bit in sr is set to 1. 9.the way that generated the exception is set in the rc field in mmucr. 10.execution branches to the address obtained by adding the value of the vbr contents and h'00000100 to invoke the tlb protection violation exception handler. software (tlb protection violation handler) operations: software resolves the tlb protection violation and issues the rte (return from exception handler) instruction to terminate the handler and return to the instruction stream.
79 3.5.3 tlb invalid exception a tlb invalid exception results when the virtual address is compared to a selected tlb entry address array and a match is found but the entry is not valid (the v bit is 0). tlb invalid exception processing includes both hardware and software operations. hardware operations: in a tlb invalid exception, the sh7709a hardware executes a set of prescribed operations, as follows: 1.the vpn number of the virtual address causing the exception is written to the pteh register. 2.the virtual address causing the exception is written to the tea register. 3.the way number causing the exception is written to rc in mmucr. 4.either exception code h'040 for a load access, or h'060 for a store access, is written to the expevt register. 5.the pc value indicating the address of the instruction in which the exception occurred is written to the spc. if the exception occurred in a delay slot, the pc value indicating the address of the delayed branch instruction is written to the spc. 6.the contents of sr at the time of the exception are written into ssr. 7.the mode (md) bit in sr is set to 1 to place the sh7709a in the privileged mode. 8.the block (bl) bit in sr is set to 1 to mask any further exception requests. 9.the register bank (rb) bit in sr is set to 1. 10.execution branches to the address obtained by adding the value of the vbr contents and h'00000100, and the tlb protection violation exception handler starts. software (tlb invalid exception handler) operations: the software searches the page tables in external memory and assigns the required page table entry. upon retrieving the required page table entry, software must execute the following operations: 1.write the values of the physical page number (ppn) field and the values of the protection key (pr), page size (sz), cacheable (c), dirty (d), share status (sh), and valid (v) bits of the page table entry recorded in the external memory to the ptel register. 2.if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 3.issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 4.issue the rte instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued after two ldtlb instructions.
80 3.5.4 initial page write exception an initial page write exception results in a write access when the virtual address and the address array of the selected tlb entry are compared and a valid entry with the appropriate access rights is found to match, but the d (dirty) bit of the entry is 0 (the page has not been written to). initial page write exception processing includes both hardware and software operations. hardware operations: in an initial page write exception, the sh7709a hardware executes a set of prescribed operations, as follows: 1.the vpn field of the virtual address causing the exception is written to the pteh register. 2.the virtual address causing the exception is written to the tea register. 3.exception code h'080 is written to the expevt register. 4.the pc value indicating the address of the instruction in which the exception occurred is written to the spc. if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written to the spc. 5.the contents of sr at the time of the exception are written to ssr. 6.the md bit in sr is set to 1 to place the sh7709a in the privileged mode. 7.the bl bit in sr is set to 1 to mask any further exception requests. 8.the register bank (rb) bit in sr is set to 1. 9.the way that caused the exception is set in the rc field in mmucr. 10.execution branches to the address obtained by adding the value of the vbr contents and h'00000100 to invoke the user-written initial page write exception handler. software (initial page write handler) operations: the software must execute the following operations: 1.retrieve the required page table entry from external memory. 2.set the d bit of the page table entry in the external memory to 1. 3.write the value of the ppn field and the pr, sz, c, d, sh, and v bits of the page table entry in the external memory to the ptel register. 4.if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 5.issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 6.issue the rte instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued after two ldtlb instructions. figure 3.11 shows the flowchart for mmu exceptions.
81 start tlb miss exception initial page write exception pr check pr check yes sh = 0 and (mmucr.sv = 0 or sr.md = 0)? vpns and asids match? vpns match? no yes yes yes yes user or privileged? d = 1? c = 1? v = 1? no no user mode privileged mode no no tlb protection violation exception tlb protection violation cache access w 00/01 10 01/11 00/10 11 ww w rr rr r/w? r/w? r/w? r/w? tlb invalid exception memory access no (noncacheable) yes (cacheable) figure 3.11 mmu exception generation flowchart
82 3.5.5 processing flow in event of mmu exception (same processing flow for address error) figure 3.12 shows the mmu exception signals in the instruction fetch mode. id ex ma wb id ex ma wb id ex ma wb nop nop if id ex ma wb : exception source stage if id ex ma wb nop mmu exception handler handler transition processing = instruction fetch = instruction decode = instruction execution = memory access = write back = no operation if figure 3.12 mmu exception signals in instruction fetch
83 figure 3.13 shows the mmu exception signals in the data access mode. if id ex if id ex if id id ex ma wb id ex ma wb id ex ma wb nop nop if id ex ma wb : exception source stage : stage cancellation for instruction that has begun execution if id ex ma wb nop = instruction fetch = instruction decode = instruction execution = memory access = write back = no operation mmu exception handler handler transition processing ma wb ma wb ex ma wb figure 3.13 mmu exception signals in data access
84 3.6 memory-mapped tlb in order for tlb operations to be managed by software, tlb contents can be read or written to in the privileged mode using the mov instruction. the tlb is assigned to the p4 area in the virtual address space. the tlb address array (vpn, v bit, and asid) is assigned to h'f2000000C h'f2ffffff, and the data array (ppn, pr, sz, c, d, and sh bits) to h'f3000000Ch'f3ffffff. the v bit in the address array can also be accessed from the data array. only longword access is possible for both the address array and the data array. 3.6.1 address array the address array is assigned to h'f2000000 to h'f2ffffff. to access an address array, the 32-bit address field (for read/write operations) and 32-bit data field (for write operations) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the vpn, v bit and asid to be written to the address array (figure 3.14 (1)). in the address field, specify the entry address for selecting the entry (bits 16C12), w for selecting the way (bits 9C8: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3) and h'f2 to indicate address array access (bits 31C24). the ix bit in mmucr indicates whether an ex-or is taken of the entry address and asid. when writing, the write is performed to the entry selected with the index address and way. when reading, the vpn, v bit, and asid of the entry selected with the index address and way in the format of the data field in figure 3.12 without comparing addresses. 0 is written to data field bits 16-12. to invalidate a specific entry, specify the entry and way, and write 0 to the corresponding v bit. 3.6.2 data array the data array is assigned to h'f3000000 to h'f3ffffff. to access a data array, the 32-bit address field (for read/write operations), and 32-bit data field (for write operations) must be specified. these are specified in the general register. the address section specifies information for selecting the entry to be accessed; the data section specifies the longword data to be written to the data array (figure 3.14 (2)). in the address section, specify the entry address for selecting the entry (bits 16C12), w for selecting the way (bits 9C8: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3), and h'f3 to indicate data array access (bits 31C24). the ix bit in mmucr indicates whether an ex-or is taken of the entry address and asid. both reading and writing use the longword of the data array specified by the entry address and way number. the access size of the data array is fixed at longword.
85 vpn 31 23 11110010 * * 16 (1) tlb address array access read access w 0 * vpn * 31 23 24 24 17 17 17 11110010 * ** * 16 write access read/write access w 60 * * 0 vpn 31 23 24 11110011 000 * * 16 17 address field w 0 * * 31 29 28 data field 10 ppn 8 9 7654 3 2 1 0 x v xx vpn 31 16 data field (2) tlb data array access 12 10 11 8 97 12 10 11 8 97 12 10 11 8 97 12 10 11 8 97 6 * 0 0 asid 0v vpn 0 0 17 vpn 16 12 10 11 vpn 31 asid 8 97 0 * v d c sh pr sz vpn: v: w: virtual page number valid bit way (00: way 0, 01: way 1, 10: way 2, 11: way 3) asid: : address space identifier dont care bit ppn: pr: c: sh: vpn: x: w: physical page number protection key field cacheable bit share status bit virtual page number 0 for read, dont care bit for write way (00: way 0, 01: way 1, 10: way 2, 11: way 3) v: sz: d: : valid bit page-size bit dirty bit dont care bit address field data field address field * * * * * * * figure 3.14 specifying address and data for memory-mapped tlb access
86 3.6.3 usage examples invalidating specific entries: specific tlb entries can be invalidated by writing 0 to the entrys v bit. when the a bit is 1, the vpn and asid specified by the write data is compared to the vpn and asid within the tlb entry selected by the entry address and data is written to the matching way. if no match is found, there is no operation. r0 specifies the write data and r1 specifies the address. ; r0=h'1547 381c r1=h'f201 3000 ; mmucr.ix=0 ; vpn(31?7)=b'0001 0101 0100 011 vpn(11?0)=b'10 asid=b'0001 1100 ; corresponding entry association is made from the entry selected by ; the vpn(16?2)=b'1 0011 index, the v bit of the hit way is cleared to ; 0,achieving invalidation. mov.l r0,@r1 reading the data of a specific entry: this example reads the data section of a specific tlb entry. the bit order indicated in the data field in figure 3.14 (2) is read. r0 specifies the address and the data section of a selected entry is read to r1. ; r1 = h'f300 4300 vpn(16-12)=b'00100 way 3 ; mov.l @r0,r1 3.7 usage note instructions that manipulate the md or bl bit in register sr (the ldc rm, sr instruction, ldc @rm+, sr instruction, and rte instruction) and the following instruction, or the ldtlb instruction, should be used with the tlb disabled or in a fixed physical address space (the p1 or p2 space).
87 section 4 exception processing 4.1 overview 4.1.1 features exception processing is separate from normal program processing, and is performed by a routine separate from the normal program. in response to an exception processing request due to abnormal termination of the executing instruction, control is passed to a user-written exception handler. however, in response to an interrupt request, normal program execution continues until the end of the executing instruction. here, all exceptions other than resets and interrupts will be called general exceptions. there are thus three types of exceptions: resets, general exceptions, and interrupts. 4.1.2 register configuration table 4.1 lists the registers used for exception processing. a register with an undefined initial value should be initialized by software. table 4.1 register configuration register abbr. r/w size initial value address trapa exception register tra r/w longword undefined h'ffffffd0 exception event register expevt r/w longword h'000/h'020 * 1 h'ffffffd4 interrupt event register intevt r/w longword undefined h'ffffffd8 interrupt event register 2 intevt2 r longword undefined h'04000000 (h'a4000000) * 2 notes: * 1 h'0000 is set in a power-on reset, and h'020 in a manual reset. * 2 when address translation by the mmu does not apply, the address in parentheses should be used. 4.2 exception processing function 4.2.1 exception processing flow in exception processing, the contents of the program counter (pc) and status register (sr) are saved in the saved program counter (spc) and saved status register (ssr), respectively, and execution of the exception handler is invoked from a vector address. the return from exception handler (rte) instruction is issued by the exception handler routine at the completion of the
88 routine, restoring the contents of the pc and sr to return to the processor state at the point of interruption and the address where the exception occurred. a basic exception processing sequence consists of the following operations: 1. the contents of the pc and sr are saved in the spc and ssr, respectively. 2. the block (bl) bit in sr is set to 1, masking any subsequent exceptions. 3. the mode (md) bit in sr is set to 1 to place the sh7709a in the privileged mode. 4. the register bank (rb) bit in sr is set to 1. 5. an exception code identifying the exception event is written to bits 11C0 of the exception event (expevt) or interrupt event (intevt and intevt2) register. 6. instruction execution jumps to the designated exception processing vector address to invoke the handler routine. 4.2.2 exception processing vector addresses the reset vector address is fixed at h'a0000000. the other three events are assigned offsets from the vector base address by software. translation look-aside buffer (tlb) miss exceptions have an offset from the vector base address of h'00000400. the vector address offset for general exception events other than tlb miss exceptions is h'00000100. the interrupt vector address offset is h'00000600. the vector base address is loaded into the vector base register (vbr) by software. the vector base address should reside in p1 or p2 fixed physical address space. figure 4.1 shows the relationship between the vector base address, the vector offset, and the vector table. vbr (vector base address) + vector offset h'a000 0000 vector address figure 4.1 vector addresses in table 4.2, exceptions and their vector addresses are listed by exception type, instruction completion state, relative acceptance priority, relative order of occurrence within an instruction execution sequence and vector address for exceptions and their vector addresses.
89 table 4.2 exception event vectors exception type current instruction exception event priority * 1 exception order vector address vector offset reset aborted power-on 1 h'a00000000 manual reset 1 h'a00000000 h-udi reset 1 ha00000000 general exception aborted and retried cpu address error (instruction access) 2 1 h'00000100 events tlb miss (instruction access) 2 2 h'00000400 tlb invalid (instruction access) 2 3 h'00000100 tlb protection violation (instruction access) 2 4 h'00000100 general illegal instruction exception 2 5 h'00000100 illegal slot instruction exception 2 5 h'00000100 cpu address error (data access) 2 6 h'00000100 tlb miss (data access not in repeat loop) 2 7 h'00000400 tlb invalid (data access) 2 8 h'00000100 tlb protection violation (data access) 2 9 h'00000100 initial page write 2 10 h'00000100 completed unconditional trap (trapa instruction) 2 5 h'00000100 user breakpoint trap 2 n * 2 h'00000100 dma address error 2 12 h'00000100
90 table 4.2 exception event vectors (cont) exception type current instruction exception event priority * 1 exception order vector address vector offset general interrupt completed nonmaskable interrupt 3 h'00000600 requests external hardware interrupt 4 * 3 h'00000600 h-udi interrupt 4 * 3 h'00000600 notes: * 1 priorities are indicated from high to low, 1 being highest and 4 being lowest. * 2 the user defines the break point traps. 1 is a break point before instruction execution and 11 is a break point after instruction execution. for an operand break point, use 11. * 3 use software to specify relative priorities of external hardware interrupts and peripheral module interrupts (see section 6, interrupt controller (intc)). 4.2.3 acceptance of exceptions processor resets and interrupts are asynchronous events unrelated to the instruction stream. all exception events are prioritized to establish an acceptance order whenever two or more exception events occur simultaneously. if a power-on reset and manual reset occur simultaneously, the power-on reset has priority. all general exception events occur in a relative order in the execution sequence of an instruction (i.e. execution order), but are handled at priority level 2 in instruction-stream order (i.e. program order), where an exception detected in a preceding instruction is accepted prior to an exception detected in a subsequent instruction. three general exception events (reserved instruction code exception, unconditional trap, and illegal slot instruction exception) are detected in the decode stage (id stage) of different instructions and are mutually exclusive events in the instruction pipeline. they have the same execution priority. figure 4.2 shows the order of general exception acceptance.
91 if instruction n id ex ma tlb miss (data access) wb if instruction n + 1 instruction n + 2 id ex ma tlb miss (instruction access) wb if id ex ma rie (reserved instruction exception) wb pipeline sequence: tlb miss (instruction n) re-execution of instruction n 1 2 3 tlb miss (instruction n + 1) re-execution of instruction n + 1 rie (instruction n + 2) if id ex ma wb = instruction fetch = instruction decode = instruction execution = memory access = write back handling order: program order: tlb miss (instruction n+1) tlb miss (instruction n) and rie (instruction n + 2) = simultaneous detection detection order: figure 4.2 example of acceptance order of general exceptions all exceptions other than a reset are detected in the pipeline id stage, and accepted on instruction boundaries. however, an exception is not accepted between a delayed branch instruction and the delay slot. a re-execution type exception detected in a delay slot is accepted before execution of the delayed branch instruction. a completion type exception detected in a delayed branch instruction or delay slot is accepted after execution of the delayed branch instruction. the delay
92 slot here refers to the next instruction after a delayed unconditional branch instruction, or the next instruction when a delayed conditional branch instruction is true. 4.2.4 exception codes an exception code is predetermined to identify each exception event, and is written to bits 11C0 of the expevt register in the case of a reset or general exception, or to the intevt and intevt2 registers in the case of a general interrupt request. these exception codes are shown in table 4.3. another exception handling related register is the trapa exception register (tra), which is used to record 8-bit immediate data for an unconditional trap (trapa instruction). table 4.3 exception codes exception type exception event exception code reset power-on reset h'000 manual reset h'020 h-udi reset h'000 general exception events tlb miss/invalid exception (read) h'040 tlb miss/invalid exception (write) h'060 initial page write exception h'080 tlb protection exception (read) h'0a0 tlb protection exception (write) h'0c0 cpu address error (read) h'0e0 cpu address error (write) h'100 unconditional trap (trapa instruction) h'160 reserved instruction code exception h'180 illegal slot instruction exception h'1a0 user breakpoint trap h'1e0 dma address error h'600 general interrupt requests nonmaskable interrupt h'1c0 h-udi interrupt h'620 external hardware interrupts: irl3Cirl0 = 0000 h'200 irl3Cirl0 = 0001 h'220 irl3Cirl0 = 0010 h'240 irl3Cirl0 = 0011 h'260 irl3Cirl0 = 0100 h'280 irl3Cirl0 = 0101 h'2a0
93 table 4.3 exception codes (cont) exception type exception event exception code general interrupt requests external hardware interrupts (cont): (cont) irl3Cirl0 = 0110 h'2c0 irl3Cirl0 = 0111 h'2e0 irl3Cirl0 = 1000 h'300 irl3Cirl0 = 1001 h'320 irl3Cirl0 = 1010 h'340 irl3Cirl0 = 1011 h'360 irl3Cirl0 = 1100 h'380 irl3Cirl0 = 1101 h'3a0 irl3Cirl0 = 1110 h'3c0 note: exception codes h'120, h'140, and h'3e0 are reserved. 4.2.5 exception request masks if a general exception event occurs when the bl bit in sr is 1, the cpus internal registers are set to their post-reset state, other module registers retain their contents prior to the general exception, and a branch is made to the same address (h'a0000000) as for a reset. if a general interrupt occurs when bl = 1, the request is masked (held pending) and not accepted until the bl bit is cleared to 0 by software. for reentrant exception processing, the spc and ssr must be saved and the bl bit in sr cleared to 0. 4.2.6 returning from exception handling the rte instruction is used to return from exception handling. when rte is executed, the spc value is set in the pc, and the ssr value in sr, and the return from exception processing is performed by branching to the spc address. if the spc and ssr have been saved in the external memory, set the bl bit in sr to 1, then restore the spc and ssr, and issue an rte instruction.
94 4.3 register description there are three registers related to exception handling. these are peripheral module registers, and therefore reside in area p4. they can be accessed by specifying the address in the privileged mode only. 1. the exception event register (expevt) resides at address h'ffffffd4, and contains a 12-bit exception code. the exception code set in expevt is that for a reset or general exception event. the exception code is set automatically by hardware when an exception occurs. expevt can also be modified by software. 2. the interrupt event register (intevt) resides at address h'ffffffd8, and contains a 12-bit interrupt exception code or a code indicating the interrupt priority. which is set when an interrupt occurs depends on the interrupt source (see tables 6.4 and 6.5, interrupt exception sources and priority). the exception code or interrupt priority code is set automatically by hardware when an exception occurs. intevt can also be modified by software. 3. interrupt event register 2 (intevt2) resides at address h'04000000, and contains a 12-bit exception code. the exception code set in intevt2 is that for an interrupt request. the exception code is set automatically by hardware when an exception occurs. 4. the trapa exception register (tra) resides at address h'ffffffd0, and contains 8-bit immediate data (imm) for the trapa instruction. tra is set automatically by hardware when a trapa instruction is executed. tra can also be modified by software. the bit configurations of the expevt, intevt, and tra registers are shown in figure 4.3. 31 0 0 exception code imm 00 11 0 expevt register, intevt and intevt2 registers 8-bit immediate data in trapa instruction imm: 0: reserved bits, always read as zero 31 00 920 tra register figure 4.3 bit configurations of expevt, intevt, intevt2, and tra registers 4.4 exception handler operation 4.4.1 reset the reset sequence is used to power up or restart the sh7709a from the initialization state. the resetp signal and resetm signal are sampled every clock cycle, and in the case of a power-on reset, all processing being executed (excluding the rtc) is suspended, all unfinished events are canceled, and reset processing is executed immediately. in the case of a manual reset, however,
95 processing to retain external memory contents is continued. the reset sequence consists of the following operations: 1. the md bit in sr is set to 1 to place the sh7709a in privileged mode. 2. the bl bit in sr is set to 1, masking any subsequent exceptions. 3. the rb bit in sr is set to 1. 4. an encoded value of h'000 in a power-on reset or h'020 in a manual reset is written to bits 11C 0 of the expevt register to identify the exception event. 5. instruction execution jumps to the user-written exception handler at address h'a0000000. 4.4.2 interrupts an interrupt processing request is accepted on completion of the current instruction. the interrupt acceptance sequence consists of the following operations: 1. the contents of the pc and sr are saved in spc and ssr, respectively. 2. the bl bit in sr is set to 1, masking any subsequent exceptions. 3. the md bit in sr is set to 1 to place the sh7709a in privileged mode. 4. the rb bit in sr is set to 1. 5. an encoded value identifying the exception event is written to bits 11C0 of the intevt and intevt2 registers. 6. instruction execution jumps to the vector location designated by the sum of the value of the contents of the vector base register (vbr) and h'00000600 to invoke the exception handler. 4.4.3 general exceptions when the sh7709a encounters any exception condition other than a reset or interrupt request, it executes the following operations: 1. the contents of the pc and sr are saved in the spc and ssr, respectively. 2. the bl bit in sr is set to 1, masking any subsequent exceptions. 3. the md bit in sr is set to 1 to place the sh7709a in privileged mode. 4. the rb bit in sr is set to 1. 5. an encoded value identifying the exception event is written to bits 11C0 of the expevt register. 6. instruction execution jumps to the vector location designated by either the sum of the vector base address and offset h'00000400 in the vector table in a tlb miss trap, or by the sum of the vector base address and offset h'00000100 for exceptions other than tlb miss traps, to invoke the exception handler.
96 4.5 individual exception operations this section describes the conditions for specific exception processing, and the processor operations. 4.5.1 resets ? power-on reset ? conditions: resetp low ? operations: expevt set to h'000, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb and bl bits are set to 1 and the interrupt mask bits (i3 to i0) are set to b'1111. the cpu and on-chip supporting modules are initialized. see the register descriptions in the relevant sections for details. a power-on reset must always be performed when powering on. a low level is output from the resetout pin, and a high level is output from the status0 and status1 pins. ? manual reset ? conditions: resetm low ? operations: expevt set to h'020, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb, and bl bits are set to 1 and the interrupt mask bits (i3 to i0) are set to b'1111. the cpu and on-chip supporting modules are initialized. see the register descriptions in the relevant sections for details. a low level is output from the resetout pin, and a high level is output from the status0 and status1 pins. ? h-udi reset ? conditions: h-udi reset command input (see section 25.4.3, h-udi reset) ? operations: expevt set to h'000, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb and bl bits are set to 1 and the interrupt mask bits (i3 to i0) are set to b'1111. the cpu and on-chip supporting modules are initialized. see the register descriptions in the relevant sections for details.
97 table 4.4 types of reset internal state type conditions for transition to reset state cpu on-chip supporting modules power-on reset resetp = low initialized (see register configuration in relevant sections) manual reset resetm = low initialized h-udi reset h-udi reset command input initialized 4.5.2 general exceptions ? tlb miss exception ? conditions: comparison of tlb addresses shows no address match ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31C10). the asid of pteh indicates the asid at the time the exception occurred. the rc bit in mmucr is incremented by 1 when all ways are enabled, and if there is a disabled way, setting is prioritized starting from way 0. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'040 is set in expevt; if the exception occurred during a write, h'060 is set in expevt. the bl, md and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0400. to speed up tlb miss processing, the offset differs from other exceptions. ? tlb invalid exception ? conditions: comparison of tlb addresses shows address match but v = 0. ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31C10). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bits in mmucr. the pc and sr of the instruction that generated the exception are saved in the spc and ssr, respectively. if the exception occurred during a read, h'040 is set in expevt; if the exception occurred during a write, h'060 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100.
98 ? initial page write exception ? conditions: a hit occurred to the tlb for a store access, but d = 0. this occurs for initial writes to the page registered by the load. ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31C10). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bit in mmucr. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. h'080 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs in pc = vbr + h'0100. ? tlb protection exception ? conditions: when a hit access violates the tlb protection information (pr bits) shown below: pr privileged mode user mode 00 only read enabled no access 01 read/write enabled no access 10 only read enabled only read enabled 11 read/write enabled read/write enabled ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31C10). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bits in mmucr. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'0a0 is set in expevt; if the exception occurred during a write, h'0c0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. ? address error ? conditions: a. instruction fetch from odd address (4n + 1, 4n + 3) b. word data accessed from addresses other than word boundaries (4n + 1, 4n + 3) c. longword accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) d. virtual space accessed in user mode in the area h'80000000 to h'ffffffff. ? operations: the virtual address (32 bits) that caused the exception is set in tea. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'0e0 is set in expevt; if the exception occurred during a write, h'100 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100.
99 for details, see 3.5.5., processing flow in event of mmu exception occurrence, in section 3, mmu. ? unconditional trap ? conditions: trapa instruction executed ? operations: the exception is a processing completion type, so the pc of the instruction after the trapa instruction is saved to the spc. sr from the time when the trapa instruction was executing is saved to ssr. the 8-bit immediate value in the trapa instruction is quadrupled and set in tra (9C0). h'160 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. ? reserved instruction exception ? conditions: a. when undefined code not in a delay slot is decoded delay branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s undefined instruction: h'fxxx b. when a privileged instruction not in a delay slot is decoded in user mode privileged instructions: ldc, stc, rte, ldtlb, sleep; instructions that access gbr with ldc/stc are not privileged instructions. ? operations: the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. h'180 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. when an undefined instruction other than h'fxxx is decoded, operation cannot be guaranteed. ? illegal slot instruction exception ? conditions: a. when undefined code in a delay slot is decoded delay branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s b. undefined instruction = h'fxxx when an instruction that rewrites the pc in a delay slot is decoded instructions that rewrite the pc: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt, bf, bt/s, bf/s, trapa, ldc rm, sr, ldc.l @rm+, sr c. when a privileged instruction in a delay slot is decoded in user mode privileged instructions: ldc, stc, rte, ldtlb, sleep; instructions that access gbr with ldc/stc are not privileged instructions. ? operations: the pc of the previous delay branch instruction is saved to the spc. sr of the instruction that generated the exception is saved to ssr. h'1a0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. when an undefined instruction other than h'fxxx is decoded, operation cannot be guaranteed. ? user break point trap ? conditions: when a break condition set in the user break controller is satisfied
100 ? operations: when a post-execution break occurs, the pc of the instruction immediately after the instruction that set the break point is set in the spc. if a pre-execution break occurs, the pc of the instruction that set the break point is set in the spc. sr when the break occurs is set in ssr. h'1e0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. see section 10, user break controller, for more information. ? dma address error ? conditions: a. word data accessed from addresses other than word boundaries (4n + 1, 4n + 3) b. longword accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) ? operations: the pc of the instruction immediately after the instruction executed before the exception occurs is saved to the spc. sr when the exception occurs is saved to ssr. h'5c0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. 4.5.3 interrupts 1. nmi conditions: nmi pin edge detection operations: the pc and sr immediately after the instruction that receives the interrupt are saved to the spc and ssr, respectively. h'01c0 is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to pc = vbr + h'0600. when the bl bit in sr is 0, this interrupt is not masked by the interrupt mask bit in sr, and is accepted with top priority. when the bl bit is 1, the interrupt is masked. when blmsk in icri is a logic zero and not masked when blmsk in icri is a logic one. see section 6, interrupt controller (intc), for more information. 2. irl interrupts conditions: when the value of the interrupt mask bits is lower than the irl(3C0) level, and the bl bit in sr is 0, the interrupt is accepted at an instruction boundary. operations: the pc after the instruction that accepts the interrupt is saved to the spc. sr at the time the interrupt is accepted is saved to ssr. the code corresponding to the irl3Cirl0 level is set in intevt and intevt2. the corresponding code is given as h'200 + [irl(3C0) value] h'20. the bl, md, and rb bits in sr are set to 1 and a branch occurs to vbr + h'0600. the received level is not set in the interrupt mask bit of sr. see section 6, interrupt controller (intc), for more information. for the corresponding codes, see table 6.5, interrupt exception handling sources and priority (irl mode).
101 3. irq pin interrupts conditions: when the irq pin is asserted, the value of the interrupt mask bits of sr is lower than the irq priority level, and the bl bit in sr is 0, the interrupt is accepted at an instruction boundary. operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. the code corresponding to the interrupt source is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. the received level is not set to the interrupt mask bit of sr. see section 6, interrupt controller (intc), for more information. 4. pint pin interrupts conditions: when the pint pin is asserted, the value of the interrupt mask bits of sr is lower than the pint priority level, and the bl bit in sr is 0, the interrupt is accepted at an instruction boundary. operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. the code corresponding to the interrupt source is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. the received level is not set to the interrupt mask bit of sr. see section 6, interrupt controller (intc), for more information. 5. on-chip peripheral module interrupts conditions: when the value of the interrupt mask bits of sr is lower than the on-chip peripheral module (tmu, rtc, sci0, sci1, sci2, a/d, lcdc, pcc, dmac, cpg, ref) interrupt level and the bl bit in sr is 0, the interrupt is accepted at an instruction boundary. operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. the code corresponding to the interrupt source is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. see section 6, interrupt controller (intc), for more information. 6. h-udi interrupt conditions: when an h-udi interrupt command is input (see section 22.4.4, h-udi interrupt), the value of the interrupt mask bits of sr is lower than 15, and the bl bit in sr is 0, the interrupt is accepted at an instruction boundary. operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. h5e0 is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. see section 6, interrupt controller (intc), for more information.
102 4.6 cautions ? return from exception processing ? check the bl bit in sr with software. if the spc and ssr have been saved to external memory, set the bl bit in sr to 1 before restoring them. ? issue an rte instruction. set the spc in the pc and ssr in sr with the rte instruction, branch to the spc address, and return from exception processing. ? operation when exception or interrupt occurs while sr.bl = 1 ? interrupt: acceptance is suppressed until the bl bit in sr is set to 0 by software. if there is a request and the acceptance conditions are satisfied, the interrupt is accepted after execution of the instruction that sets the bl bit in sr to 0. in the sleep or standby mode, however, the interrupt will be accepted even if the bl bit in sr is 1. when the blmsk bit in icr1 is 1, nmi is accepted regardless of the bl bit setting. if there is a request and the reception conditions are satisfied, the interrupt is accepted after the execution of the instruction that sets the bl bit in sr to 0. during the sleep or standby mode, however, the interrupt will be accepted even when the bl bit in sr is 1. nmi is accepted when blmsk in icr1 is 1. ? exception: no user break point trap will occur even if a break condition is met. when one of the other exceptions occurs, a branch is made to the fixed address of the reset (h'a0000000). in this case, the values of the expevt, spc, and ssr registers are undefined. differently from general reset processing, no signal is output from resetout , status0, and status1. ? spc when an exception occurs: the pc saved to the spc when an exception occurs is as shown below: ? re-executing type exceptions: the pc of the instruction that caused the exception is set in the spc and re-executed after return from exception processing. if the exception occurred in a delay slot, however, the pc of the immediately prior delayed branch instruction is set in the spc. if the condition of the conditional delayed branch instruction is not satisfied, the delay slot pc is set in spc. ? completion-type exceptions and interrupts: the pc of the instruction after the one that caused the exception is set in the spc. if the exception was caused by a delayed conditional instruction, however, the branch destination pc is set in spc. if the condition of the conditional delayed branch instruction is not satisfied, the delay slot pc is set in spc. ? initial register values after reset ? undefined registers r0_bank0/1Cr7_bank0/1, r8Cr15, gbr, spc, ssr, mach, macl, pr ? initialized registers
103 vbr = h'00000000 sr.md = 1, sr.bl = 1, sr.rb = 1, sr.i3Csr.i0 = h'f. other sr bits are undefined. pc = h'a0000000 ? ensure that an exception is not generated at an rte instruction delay slot, as operation is not guaranteed in this case. ? when the bl bit in the srl register is set to 1, ensure that a tlb-related exception or address error does not occur at an ldc instruction that updates the sr register and the following instruction. this occurrence will be identified as multiple exceptions, and may initiate reset processing.
104
105 section 5 cache 5.1 overview 5.1.1 features the cache specifications are listed in table 5.1. table 5.1 cache specifications parameter specification capacity 16 kbytes structure instruction/data mixed, 4-way set associative locking way 2 and way 3 are lockable line size 16 bytes number of entries 256 entries/way write system p0, p1, p3, u0: write-back/write-through selectable replacement method least-recently-used (lru) algorithm 5.1.2 cache structure the cache mixes data and instructions and uses a 4-way set associative system. it is composed of four ways (banks), each of which is divided into an address section and a data section. each of the address and data sections is divided into 256 entries. the data section of the entry is called a line. each line consists of 16 bytes (4 bytes 4). the data capacity per way is 4 kbytes (16 bytes 256 entries), with a total of 16 kbytes in the cache as a whole (4 ways). figure 5.1 shows the cache structure.
106 24 (1 + 1 + 22) bits 128 (32 4) bits 6 bits lw0Clw3: longword data 0C3 entry 0 entry 1 entry 255 0 1 255 0 1 255 v u tag address lw0 lw1 lw2 lw3 address array (ways 0C3) data array (ways 0C3) lru . . . . . . . . . . . . . . . . . . figure 5.1 cache structure address array: the v bit indicates whether the entry data is valid. when the v bit is 1, data is valid; when 0, data is not valid. the u bit indicates whether the entry has been written to in write- back mode. when the u bit is 1, the entry has been written to; when 0, it has not. the address tag holds the physical address used in the external memory access. it is composed of 22 bits (address bits 31C10) used for comparison during cache searches. in the sh7709a, the top three of 32 physical address bits are used as shadow bits (see section 11, bus state controller (bsc)), and therefore in a normal replace operation the top three bits of the tag address are cleared to 0. the v and u bits are initialized to 0 by a power-on reset, but are not initialized by a manual reset. the tag address is not initialized by either a power-on or manual reset. data array: holds a 16-byte instruction or data. entries are registered in the cache in line units (16 bytes). the data array is not initialized by a power-on or manual reset. lru: with the 4-way set associative system, up to four instructions or data with the same entry address (address bits 11C4) can be registered in the cache. when an entry is registered, the lru shows which of the four ways it is recorded in. there are six lru bits, controlled by hardware. a least-recently-used (lru) algorithm is used to select the way. in normal operation, four ways are used as cache and six lru bits indicate the way to be replaced (table 5.2). if a bit pattern other than those listed in table 5.2 is set in the lru bits by software, the cache will not function correctly. when modifying the lru bits by software, set one of the patterns listed in table 5.2. the lru bits are initialized to 0 by a power-on reset, but are not initialized by a manual reset.
107 table 5.2 lru and way replacement lru (5C0) way to be replaced 000000, 000100, 010100, 100000, 110000, 110100 3 000001, 000011, 001011, 100001, 101001, 101011 2 000110, 000111, 001111, 010110, 011110, 011111 1 111000, 111001, 111011, 111100, 111110, 111111 0 5.1.3 register configuration table 5.3 shows details of the cache control register. table 5.3 register configuration register abbr. r/w size initial value address cache control register ccr r/w longword h'00000000 h'ffffffec cache control register 2 ccr2 w longword h'00000000 h'040000b0 (ha40000b0) * note: * when address translation by the mmu does not apply, the address in parentheses should be used. 5.2 register description 5.2.1 cache control register (ccr) the cache is enabled or disabled using the ce bit of the cache control register (ccr). ccr also has a cf bit (which invalidates all cache entries), and a wt and cb bits (which select either write- through mode or write-back mode). programs that change the contents of the ccr register should be placed in address space that is not cached. figure 5.2 shows the configuration of the ccr register.
108 ce wt cf cb 0 1 2 3 4 5 6 31 cf: cache flush bit. writing 1 flushes all cache entries (clears the v, u, and lru bits of all cache entries to 0). always reads 0. write-back to external memory is not performed when the cache is flushed. cb: cache write-back bit. indicates the caches operating mode for area p1. 1 = write-back mode, 0 = write-through mode. wt: write-through bit. indicates the caches operating mode for area p0, u0 and p3. 1 = write-through mode, 0 = write-back mode. ce: cache enable bit. indicates whether the cache function is used. 1 = cache used, 0 = cache not used. figure 5.2 ccr register configuration 5.2.2 cache control register 2 (ccr2) ccr2 register is used to enable or disable cache locking mechanism during dsp mode (cpu status register bit 12) only. executing a prefetch instruction (pref) during dsp mode will bring in one line size of data pointed by rn to cache, according to the setting of ccr2 [9:8] (w3load, w3lock) and [1:0] (w2load, w2lock): when ccr2[9:8]=11, during dsp mode pref @rn will bring the data into way 3. when ccr2[9:8]=00, 01 or 10 during dsp mode, or any setting during non-dsp mode, pref @rn will place the data into the way pointed by lru. when ccr2[1:0]=11, during dsp mode pref @rn will bring the data into way 2. when ccr2[1:0]=00, 01 or 10 during dsp mode, or any setting during non-dsp mode, pref @rn will place the data into the way pointed by lru. ccr2 must be set before cache is enabled (ccr.ce = 1). when a pref instruction is issued and there is a cache hit, the operation is treated as nop. figure 5.3 shows the configuration of the ccr2 register. ccr2 is a write-only register; if read, an undefined value will be returned.
109 31 9 8 7 2 1 0 w2 load w3 lock w3 load w2 lock w2lock: way 2 lock bit. w2load: way 2 load bit. when w2lock = 1 & w2load = 1 & dsp = 1, the prefetched data will always be loaded into way2. in all other conditions the prefetched data will be loaded into the way pointed by lru. w3lock: way 3 lock bit. w3load: way 3 load bit. when w3lock = 1 & w3load = 1 & dsp = 1, the prefetched data will always be loaded into way3. in all other conditions the prefetched data will be loaded into the way pointed by lru. note: w2load and w3load should not be set to high at the same time. figure 5.3 ccr2 register configuration whenever ccr2 bit 8 (w3lock) or bit 0 (w2lock) is high the cache is locked. the locked data will not be overwritten unless w3lock bit and w2lock bit are reset or the pref condition during dsp mode matched. during cache locking mode, the lru in table 5.2 will be replaced by tables 5.4 to 5.6. table 5.4 lru and way replacement (when w2lock=1) lru (5C0) way to be replaced 000000, 000001, 000100, 010100, 100000, 100001, 110000, 110100 3 000011, 000110, 000111, 001011, 001111, 010110, 011110, 011111 1 101001, 101011, 111000, 111001, 111011, 111100, 111110, 111111 0 table 5.5 lru and way replacement (when w3lock=1) lru (5C0) way to be replaced 000000, 000001, 000011, 001011, 100000, 100001, 101001, 101011 2 000100, 000110, 000111, 001111, 010100, 010110, 011110, 011111 1 110000, 110100, 111000, 111001, 111011, 111100, 111110, 111111 0
110 table 5.6 lru and way replacement (when w2lock=1 and w3lock=1) lru (5C0) way to be replaced 000000, 000001, 000011, 000100, 000110, 000111, 001011, 001111, 010100, 010110, 011110, 011111 1 100000, 100001, 101001, 101011, 110000, 110100, 111000, 111001, 111011, 111100, 111110, 111111 0 5.3 cache operation 5.3.1 searching the cache if the cache is enabled, whenever instructions or data in memory are accessed the cache will be searched to see if the desired instruction or data is in the cache. figure 5.4 illustrates the method by which the cache is searched. the cache is a physical cache and holds physical addresses in its address section. entries are selected using bits 11C4 of the address (virtual) of the access to memory and the address tag of that entry is read. in parallel to reading of the address tag, the virtual address is translated to a physical address in the mmu. the physical address after translation and the physical address read from the address section are compared. the address comparison uses all four ways. when the comparison shows a match and the selected entry is valid (v = 1), a cache hit occurs. when the comparison does not show a match or the selected entry is not valid (v = 0), a cache miss occurs. figure 5.4 shows a hit on way 1.
111 0 1 255 v u tag address lw0 lw1 lw2 lw3 ways 0C3 ways 0C3 31 12 11 4 3 2 1 0 virtual address cmp0 cmp1 cmp2 cmp3 physical address cmp0: comparison circuit 0 cmp1: comparison circuit 1 cmp2: comparison circuit 2 cmp3: comparison circuit 3 hit signal 1 entry selection longword (lw) selection mmu figure 5.4 cache search scheme (normal mode)
112 5.3.2 read access read hit: in a read access, instructions and data are transferred from the cache to the cpu, the lru is updated. read miss: an external bus cycle starts and the entry is updated. the way replaced is the one least recently used. entries are updated in 16-byte units. when the desired instruction or data that caused the miss is loaded from external memory to the cache, the instruction or data is transferred to the cpu in parallel with being loaded to the cache. when it is loaded in the cache, the u bit is cleared to 0 and the v bit is set to 1. when the u bit of a replaced entry in write-back mode is 1, the cache fill cycle starts after the entry is transferred to the write-back buffer. after the cache completes its fill cycle, the write-back buffer writes back the entry to the memory. the write-back unit is 16 bytes. 5.3.3 prefetch operations prefetch hit: the lru is updated so that the hit way becomes the most recent. other cache contents are not updated. instruction or data transfer to the cpu is not performed. prefetch miss: instruction or data transfer to the cpu is not performed, and the way replaced is as shown in table 5.4. other operations are the same as in the case of a read miss. 5.3.4 write access write hit: in a write access in the write-back mode, the data is written to the cache and the u bit of the entry written is set to 1. writing occurs only to the cache; no external memory write cycle is issued. in the write-through mode, the data is written to the cache and an external memory write cycle is issued. write miss: in the write-back mode, an external write cycle starts when a write miss occurs, and the entry is updated. the way to be replaced is the one least recently used. when the u bit of the entry to be replaced is 1, the cache fill cycle starts after the entry is transferred to the write-back buffer. the write-back unit is 16 bytes. data is written to the cache and the u bit is set to 1 and the v bit is also set to 1. after the cache completes its fill cycle, the write-back buffer writes back the entry to the memory. in the write-through mode, no write to cache occurs in a write miss; the write is only to the external memory. 5.3.5 write-back buffer when the u bit of the entry to be replaced in the write-back mode is 1, it must be written back to the external memory. to increase performance, the entry to be replaced is first transferred to the write-back buffer and fetching of new entries to the cache takes priority over writing back to the external memory. during the write back cycles, the cache can be accessed. the write-back buffer
113 can hold one line of the cache data (16 bytes) and its physical address. figure 5.5 shows the configuration of the write-back buffer. longword 0 longword 1 longword 2 longword 3 pa (31C4) pa (31C4): longword 0C3: physical address written to external memory the line of cache data to be written to external memory figure 5.5 write-back buffer configuration 5.3.6 coherency of cache and external memory use software to ensure coherency between the cache and the external memory. when memory shared by this lsi and another device is accessed, the latest data may be in a write-back mode cache, so invalidate the entry that includes the latest data in the cache, generate a write back, and update the data in memory before using it. when the caching area is updated by a device other than the sh7709a, invalidate the entry that includes the updated data in the cache. 5.4 memory-mapped cache to allow software management of the cache, cache contents can be read and written by means of mov instructions in the privileged mode. the cache is mapped onto the p4 area in virtual address space. the address array is mapped onto addresses h'f0000000 to h'f0ffffff, and the data array onto addresses h'f1000000 to h'f1ffffff. only longword can be used as the access size for the address array and data array, and instruction fetches cannot be performed. 5.4.1 address array the address array is mapped onto h'f0000000 to h'f0ffffff. to access an address array, the 32-bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the address, v bit, u bit, and lru bits to be written to the address array (figure 5.6 (1)). in the address field, specify the entry address selecting the entry (bits 11C4), w for selecting the way (bits 12C11: in normal mode (16-kbyte cache), 00 is way 0, 01 is way 1, 10 is way 2, and 11 is way 3), and h'f0 to indicate address array access (bits 31C24). when writing, specify bit 3 as the a bit. the a bit indicates whether addresses are compared during writing. when the a bit is 1, the addresses of four entries selected by the entry addresses are compared to the addresses to be written into the address array specified in the data field.
114 writing takes place to the way that has a hit. when a miss occurs, nothing is written to the address array and no operation occurs. the way number (w) specified in bits 12C11 is not used. when the a bit is 0, it is written to the entry selected with the entry address and way number without comparing addresses. the address specified by bits 31C10 in the data specification in figure 5.6 (1), address array access, is a virtual address. when the mmu is enabled, the address is translated into a physical address, then the physical address is used in comparing addresses when the a bit is 1. the physical address is written into the address array. when reading, the address tag, v bit, u bit, and lru bits of the entry specified by the entry address and way number (w) are read using the data format shown in figure 5. 6 without comparing addresses. to invalidate a specific entry, specify the entry by its entry address and way number, and write 0 to its v bit. to invalidate only an entry for an address to be invalidated, specify 1 for the a bit. when an entry for which 0 is written to the v bit has a u bit set to 1, it will be written back. this allows coherency to be achieved between the external memory and cache by invalidating the entry. however, when 0 is written to the v bit, 0 must also be written to the u bit of that entry. in the sh7709a, the upper 3 bits of the 32-bit physical address are treated as a shadow field (see section 11, bus state controller (bsc)). therefore, when a cache miss occurs, 0 is stored in the upper 3 bits of the address array address tag. when using an mov instruction to modify the address array directly, a nonzero value must not be written to the upper 3 bits of the address tag. 5.4.2 data array the data array is mapped onto h'f1000000 to h'f1ffffff. to access a data array, the 32-bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the longword data to be written to the data array (figure 5.6 (2)). specify the entry address for selecting the entry (bits 11C4), l indicating the longword position within the (16-byte) line (bits 3C2: 00 is longword 0, 01 is longword 1, 10 is longword 2, and 11 is longword 3), w for selecting the way (bits 12C11: in normal mode, 00 is way 0, 01 is way 1, 10 is way 2, and 11 is way 3), and h'f1 to indicate data array access (bits 31C24). both reading and writing use the longword of the data array specified by the entry address, way number and longword address. the access size of the data array is fixed at longword.
115 1. address array access address specification read access write access data specification 2. data array access (both read and write accesses) address specification 31 24 23 14 13 12 11 4 3 0 1111 0000 * * * * * * * 0 0 * 0 0 w entry 31 24 23 14 13 12 11 4 3 0 1111 0000 w entry 2 a 31 30 29 10 4 3 0 lru 2 x 000 x 9 address tag (28C10) uv 1 31 24 23 14 13 12 11 4 3 0 1111 0001 w entry 0 0 1 2 l data specification 31 0 longword x: 0 for read, dont care for write * : dont care bit 0 2 figure 5.6 specifying address and data for memory-mapped cache access
116 5.5 usage examples 5.5.1 invalidating specific entries a specific cache entry can be invalidated by writing 0 to the entrys u bit and v bit. when the a bit is 1, the address tag specified by the write data is compared to the address tag within the cache selected by the entry address, and data is written when a match is found. if no match is found, there is no operation. r0 specifies the write data in r0 and r1 specifies the address. when the v bit of an entry in the address array is set to 0, the entry is written back if the entrys u bit is 1. ; r0 = h'01100010; vpn = b'0000 0001 0001 0000 0000 00, u = 0, v = 0 ; r1 = h'f0000088; address array access, entry = b'00001000, a = 1 ; mov.l r0,@r1 5.5.2 reading the data of a specific entry this example reads the data section of a specific cache entry. the longword indicated in the data field of the data array in figure 5.6 is read to the register. r0 specifies the address and r1 is read. ; r1 = h'f100 004c; data array access, entry = b'00000100, way = 0, ; longword address = 3 ; mov.l @r0,r1 ; longword 3 is read. 5.6 usage note 5.6.1 cache lock function when the cache controllers cache lock function is used, write-back may not be performed correctly. when using the cache lock function, write-through mode (bit 2 (cb) =0 and bit 1 (wt) = 1 in the cache control register (ccr)), not write-back mode, should be used.
117 section 6 interrupt controller (intc) 6.1 overview the interrupt controller (intc) ascertains the priority of interrupt sources and controls interrupt requests to the cpu. the intc has registers for setting the priority of each interrupt, and interrupt requests are handled according to the priorities set in these registers. 6.1.1 features intc has the following features: ? 16 levels of interrupt priority can be set: by setting the five interrupt-priority registers, the priorities of on-chip peripheral module, irq, and pint interrupts can be selected from 16 levels for individual request sources. ? nmi noise canceler function: nmi input-level bit indicates nmi pin states. by reading this bit in the interrupt exception service routine, the pin state can be checked, enabling it to be used as a noise canceler. ? external devices can be notified that an interrupt has been received ( irqout ): when the sh7709a has released the bus right, the external bus master can be notified that an external interrupt, an on-chip peripheral module interrupt or a memory refresh request has occurred, enabling this lsi to request the bus right.
118 6.1.2 block diagram figure 6.1 is a block diagram of the intc. ref irda dmac icr input control com- parator priority identifier 3 4 6 16 interrupt request sr ipraCipre irl3 C irl0 nmi irq0Cirq5 pint0Cpint15 irqout timer unit realtime clock unit serial communication interface serial communication interface (with irda) serial communication interface (with fifo) watchdog timer refresh requests in the bus state controller interrupt control register registers a-e for setting the interrupt proprity levels status register direct memory access controller analog-to-digital converter hitachi user-debugging interface tmu: rtc: sci: irda: scif: wdt: ref: icr: ipra-ipre: sr: dmac: adc: h-udi: (interrupt request) scif tmu (interrupt request) (interrupt request/ cpu internal bus bus interface 2 1 0 (interrupt request) (interrupt request) rtc wdt (interrupt request) (interrupt request) irls3 C irls0 4 sci (interrupt request) adc (interrupt request) h-udi (interrupt request) refresh request) legend: intc ipr figure 6.1 intc block diagram
119 6.1.3 pin configuration table 6.1 lists the intc pin configuration. table 6.1 pin configuration name abbreviation i/o description nonmaskable interrupt input pin nmi i nonmaskable interrupt request signal input interrupt input pins irq5Cirq0 irl3 C irl0 irls3 - irls0 i interrupt request signal input (maskable by interrupt mask bits in sr) port interrupt input pins pint0Cpint15 i port interrupt request signal input (maskable by interrupt mask bits in sr) interrupt request output pin irqout o output of signal that notifies external devices that an interrupt source or memory refresh has occurred
120 6.1.4 register configuration the intc has 12 registers listed in table 6.2. table 6.2 register configuration name abbr. r/w initial value * 1 address access size interrupt control register 0 icr0 r/w * 2 h'fffffee0 16 interrupt control register 1 icr1 r/w h'0000 h'04000010 (h'a4000010) * 3 16 interrupt control register 2 icr2 r/w h'0000 h'04000012 (h'a4000012) * 3 16 pint interrupt enable register pinter r/w h'0000 h'04000014 (h'a4000014) * 3 16 interrupt priority level setting register a ipra r/w h'0000 h'fffffee2 16 interrupt priority level setting register b iprb r/w h'0000 h'fffffee4 16 interrupt priority level setting register c iprc r/w h'0000 h'04000016 (h'a4000016) * 3 16 interrupt priority level setting register d iprd r/w h'0000 h'04000018 (h'a4000018) * 3 16 interrupt priority level setting register e ipre r/w h'0000 h'0400001a (h'a400001a) * 3 16 interrupt request register 0 irr0 r/w h'00 h'04000004 (h'a4000004) * 3 8 interrupt request register 1 irr1 r h'00 h'04000006 (h'a4000006) * 3 8 interrupt request register 2 irr2 r h'00 h'04000008 (h'a4000008) * 3 8 notes: the registers that have addresses that start with h'04 are located to area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 initialized by a power-on or manual reset. * 2 h'8000 when the nmi pin is at high level. h'0000 when the nmi pin is at low level. * 3 when address translation by the mmu does not apply, the address in parentheses should be used.
121 6.2 interrupt sources there are five types of interrupt sources: nmi, irq, irl, pint, and on-chip peripheral modules. the priority of each interrupt is indicated by a priority level value (16C0), with level 16 as the highest and level 1 as the lowest. when level 0 is set, the interrupt is masked and interrupt requests are ignored. 6.2.1 nmi interrupts the nmi interrupt has the highest priority level of 16. when the blmsk bit of the interrupt control register (icr1) is 1 or the bl bit of the status register (sr) is 0, nmi interrupts are accepted when the mai bit of the icr1 register is 0. nmi interrupts are edge-detected. in sleep or standby mode, the interrupt is accepted regardless of the bl. the nmi edge select bit (nmie) in the interrupt control register 0 (icr0) is used to select either the rising or falling edge. when the nmie bit of the icr0 register is changed, the nmi interrupt is not detected for 20 cycles after changing the icr0.nmie to avoid a false detection of the nmi interrupt. nmi interrupt exception processing does not affect the interrupt mask level bits (i3Ci0) in the status register (sr). when the bl bit is 1 and the blmsk bit of the icr1 register is set to 1, only nmi interrupts are accepted and the spc register and ssr register are updated by the nmi interrupt handler, making it impossible to return to the original processing from exception processing initiated prior to the nmi. use should therefore be restricted to cases where return is not necessary. it is possible to wake the chip up from the standby state with an nmi interrupt (except when the mai bit of the icr1 register is set to 1). 6.2.2 irq interrupt irq interrupts are input by priority from pins irq0Cirq5 with a level or an edge. the priority level can be set by priority setting registers cCd (iprcCiprd) in a range from levels 0C15. when using edge-sensing for irq interrupts, clear the interrupt source by having software read 1 from the corresponding bit in irr0, then write 0 to the bit. when the icr1 register is rewritten, irq interrupts may be mistakenly detected, depending on the pin states. to prevent this, rewrite the register while interrupts are masked, then release the mask after clearing the illegal interrupt by writing 0 to interrupt request register 0 (irr0). it is necessary for an edge input interrupt detection to input a pulse width more than two-cycle width by p clock basis. with level detection, the level must be maintained until the interrupt is accepted and the cpu starts interrupt handling.
122 the interrupt mask bits (i3Ci0) of the status register (sr) are not affected by irq interrupt processing. interrupts irq4Cirq0 can wake the chip up from the standby state when the relevant interrupt level is higher than i3Ci0 in the sr register (but only when the rtc 32-khz oscillator is used). 6.2.3 irl interrupts irl interrupts are input by level at pins irl3 C irl0 and irls3 C irls0 . irls3 C irls0 is enabled when irqlvl bit and irlsen bit in interrupt control register 1 (icr1) are both 1. the priority level is the higher of those indicated by pins irl3 C irl0 and irls3 C irls0 . an irl3 C irl0 / irls3 C irls0 value of 0 (0000) indicates the highest-level interrupt request (interrupt priority level 15). a value of 15 (1111) indicates no interrupt request (interrupt priority level 0). figure 6.2 shows an examples of an irl interrupt connection. table 6.3 shows irl / irls pins and interrupt levels. interrupt request priority encoder irl3 to irl0 4 sh7709a irl3 to irl0 interrupt request priority encoder irls3 to irls0 4 irls3 to irls0 figure 6.2 example of irl interrupt connection
123 table 6.3 irl3 C irl0 / irls3 C irls0 pins and interrupt levels irl3 / irls3 irl2 / irls2 irl1 / irls1 irl0/ irls0 interrupt priority level interrupt request 0000 15 level 15 interrupt request 0001 14 level 14 interrupt request 0010 13 level 13 interrupt request 0011 12 level 12 interrupt request 0100 11 level 11 interrupt request 0101 10 level 10 interrupt request 0110 9 level 9 interrupt request 0111 8 level 8 interrupt request 1000 7 level 7 interrupt request 1001 6 level 6 interrupt request 1010 5 level 5 interrupt request 1011 4 level 4 interrupt request 1100 3 level 3 interrupt request 1101 2 level 2 interrupt request 1110 1 level 1 interrupt request 1111 0 no interrupt request a noise-cancellation feature is built in, and the irl interrupt is not detected unless the levels sampled at every supporting module cycle remain unchanged for two consecutive cycles, so that no transient level on the irl / irls pin change is detected. in the standby mode, as the peripheral clock is stopped, noise cancellation is performed using the 32-khz clock for the rtc instead. therefore when the rtc is not used, interruption by means of irl interrupts cannot be performed in standby mode. the priority level of the irl interrupt must not be lowered unless the interrupt is accepted and the interrupt processing starts. however, the priority level can be changed to a higher one. the interrupt mask bits (i3Ci0) in the status register (sr) are not affected by irl / irls interrupt processing.
124 6.2.4 pint interrupt pint interrupts are input by priority from pins pint0Cpint15 with a level. the priority level can be set by priority setting registers d (iprd) in a range from levels 0C15, in the unit of pint0C pint7 or pint8Cpint15. the pint interrupt level should be held until the interrupt is accepted and interrupt handling is started. the interrupt mask bits (i3Ci0) of the status register (sr) are not affected by pint interrupt processing. pint0 and pint1 interrupts can wake the chip up from the standby state when the relevant interrupt level is higher than i3Ci0 in the sr register (but only when the rtc 32-khz oscillator is used). 6.2.5 on-chip peripheral module interrupts on-chip peripheral module interrupts are generated by the following nine modules: ? timer unit (tmu) ? realtime clock (rtc) ? serial communication interface (sci, irda, scif) ? bus state controller (bsc) ? watchdog timer (wdt) ? direct memory access controller (dmac) ? a/d converter (adc) ? user-debugging interface (h-udi) not every interrupt source is assigned a different interrupt vector, but sources are reflected in the interrupt event registers (intevt and intevt2), so it is easy to identify sources by branching with the intevt or intevt2 register value as an offset. the priority level (from 0C15) can be set for each module except for h-udi by writing to the interrupt priority setting registers a, b and e (ipra, iprb and ipre). the priority level of h- udi interrupt is 15 (fixed). the interrupt mask bits (i3Ci0) of the status register are not affected by the on-chip peripheral module interrupt processing. tmu and rtc interrupts can restore the chip from the standby state when the relevant interrupt level is higher than i3i0 in the sr register (but only when the rtc 32-khz oscillator is used).
125 6.2.6 interrupt exception processing and priority tables 6.4 and 6.5 lists the codes for the interrupt event register (intevt and intevt2), and the order of interrupt priority. each interrupt source is assigned unique code. the start address of the interrupt service routine is common to each interrupt source. this is why, for instance, the value of intevt or intevt2 is used as offset at the start of the interrupt service routine and branched to identify the interrupt source. the order of priority of the on-chip peripheral module, irq, and pint interrupts is set within the priority levels 0C15 at will by using the interrupt priority level set to registers aCe (ipraCipre). the order of priority of the on-chip peripheral module, irq, and pint interrupts is set to zero by reset. when the order of priorities for multiple interrupt sources are set to the same level and such interrupts are generated at the same time, they are processed according to the default order listed in tables 6.4 and 6.5.
126 table 6.4 interrupt exception handling sources and priority (irq mode) interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority nmi h'1c0 (h'1c0) 16 high h-udi h'5e0 (h'5e0) 15 irq irq0 h'200C3c0 * (h'600) 0C15 (0) iprc (3C0) irq1 h'200C3c0 * (h'620) 0C15 (0) iprc (7C4) irq2 h'200C3c0 * (h'640) 0C15 (0) iprc (11C8) irq3 h'200C3c0 * (h'660) 0C15 (0) iprc (15C12) irq4 h'200C3c0 * (h'680) 0C15 (0) iprd (3C0) irq5 h'200C3c0 * (h'6a0) 0C15 (0) iprd (7C4) pint pint0-7 h'200C3c0 * (h'700) 0C15 (0) iprd (15C12) pint8-15 h'200C3c0 * (h'720) 0C15 (0) iprd (11C8) dmac dei0 h'200C3c0 * (h'800) 0C15 (0) ipre (15C12) high dei1 h'200C3c0 * (h'820) dei2 h'200C3c0 * (h'840) dei3 h'200C3c0 * (h'860) low irda eri1 h'200C3c0 * (h'880) 0C15 (0) ipre (11C8) high (sci1) rxi1 h'200C3c0 * (h'8a0) bri1 h'200C3c0 * (h'8c0) txi1 h'200C3c0 * (h'8e0) low scif eri2 h'200C3c0 * (h'900) 0C15 (0) ipre (7C4) high (sci2) rxi2 h'200C3c0 * (h'920) bri2 h'200C3c0 * (h'940) txi2 h'200C3c0 * (h'960) low adc adi h'200C3c0 * (h'980) 0C15 (0) ipre (3C0) tmu0 tuni0 h'400 (h'400) 0C15 (0) ipra (15C12) tmu1 tuni1 h'420 (h'420) 0C15 (0) ipra (11C8) tmu2 tuni2 h'440 (h'440) 0C15 (0) ipra (7C4) high ticpi2 h'460 (h'460) low low
127 table 6.4 interrupt exception handling sources and priority (irq mode) (cont) interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority rtc ati h'480 (h'480) 0C15 (0) ipra (3C0) high high pri h'4a0 (h'4a0) cui h'4c0 (h'4c0) low sci eri h'4e0 (h'4e0) 0C15 (0) iprb (7C4) high (sci0) rxi h'500 (h'500) txi h'520 (h'520) tei h'540 (h'540) low wdt iti h'560 (h'560) 0C15 (0) iprb (15C12) bsc rcmi h'580 (h'580) 0C15 (0) iprb (11C8) high (ref) rovi h'5a0 (h'5a0) low low note: * the code corresponding to an interrupt level shown in table 6.6 is set.
128 table 6.5 interrupt exception handling sources and priority (irl mode) interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority nmi h'1c0 (h'1c0) 16 high h-udi h'5e0 (h'5e0) 15 irl irl(3:0) * 2 = 0000 h'200 (h'200) 15 irl(3:0) * 2 = 0001h'220 (h'220) 14 irl(3:0) * 2 = 0010 h'240 (h'240) 13 irl(3:0) * 2 = 0011 h'260 (h'260) 12 irl(3:0) * 2 = 0100 h'280 (h'280) 11 irl(3:0) * 2 = 0101 h'2a0 (h'2a0) 10 irl(3:0) * 2 = 0110 h'2c0 (h'2c0) 9 irl(3:0) * 2 = 0111 h'2e0 (h'2e0) 8 irl(3:0) * 2 = 1000 h'300 (h'300) 7 irl(3:0) * 2 = 1001 h'320 (h'320) 6 irl(3:0) * 2 = 1010 h'340 (h'340) 5 irl(3:0) * 2 = 1011 h'360 (h'360) 4 irl(3:0) * 2 = 1100 h'380 (h'380) 3 irl(3:0) * 2 = 1101 h'3a0 (h'3a0) 2 irl(3:0) * 2 = 1110 h'3c0 (h'3c0) 1 irq irq4 h'200C3c0 * 1 (h'680) 0C15 (0) iprd (3C0) irq5 h'200C3c0 * 1 (h'6a0) 0C15 (0) iprd (7C4) pint pint0C7 h'200C3c0 * 1 (h'700) 0C15 (0) iprd (15C12) pint8C15 h'200C3c0 * 1 (h'720) 0C15 (0) iprd (11C8) dmac dei0 h'200C3c0 * 1 (h'800) 0C15 (0) ipre (15C12) high dei1 h'200C3c0 * 1 (h'820) dei2 h'200C3c0 * 1 (h'840) dei3 h'200C3c0 * 1 (h'860) low irda eri1 h'200C3c0 * 1 (h'880) 0C15 (0) ipre (11C8) high (sci1) rxi1 h'200C3c0 * 1 (h'8a0) bri1 h'200C3c0 * 1 (h'8c0) txi1 h'200C3c0 * 1 (h'8e0) low low
129 table 6.5 interrupt exception handling sources and priority (irl mode) (cont) interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority scif eri2 h'200C3c0 * 1 (h'900) 0C15 (0) ipre (7C4) high high (sci2) rxi2 h'200C3c0 * 1 (h'920) bri2 h'200C3c0 * 1 (h'940) txi2 h'200C3c0 * 1 (h'960) low adc adi h'200C3c0 * 1 (h'980) 0C15 (0) ipre (3C0) tmu0 tuni0 h'400 (h'400) 0C15 (0) ipra (15C12) tmu1 tuni1 h'420 (h'420) 0C15 (0) ipra (11C8) tmu2 tuni2 h'440 (h'440) 0C15 (0) ipra (7C4) high ticpi2 h'460 (h'460) low rtc ati h'480 (h'480) 0C15 (0) ipra (3C0) high pri h'4a0 (h'4a0) cui h'4c0 (h'4c0) low sci eri h'4e0 (h'4e0) 0C15 (0) iprb (7C4) high (sci0) rxi h'500 (h'500) txi h'520 (h'520) tei h'540 (h'540) low wdt iti h'560 (h'560) 0C15 (0) iprb (15C12) bsc rcmi h'580 (h'580) 0C15 (0) iprb (11C8) high (ref) rovi h'5a0 (h'5a0) low low notes: * 1 the code corresponding to an interrupt level shown in table 6.6 is set. * 2 when irls3 C irls0 are enabled, irl is higher level of irl3 C irl0 and irls3 C irls0 .
130 table 6.6 interrupt level and intevt code interrupt level intevt code 15 h'200 14 h'220 13 h'240 12 h'260 11 h'280 10 h'2a0 9 h'2c0 8 h'2e0 7 h'300 6 h'320 5 h'340 4 h'360 3 h'380 2 h'3a0 1 h'3c0
131 6.3 intc registers 6.3.1 interrupt priority registers a to e (ipraCipre) the interrupt priority level setting registers a to e (ipra to ipre) are 16-bit read/write registers that set priority levels from 0 to 15 for on-chip peripheral module interrupts. these registers are initialized to h'0000 at power-on reset, manual reset, or in hardware standby mode, but is not initialized in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 6.7 lists the relationship between the interrupt sources and the ipra and ipre bits. table 6.7 interrupt request sources and ipraCipre register bits 15 to 12 bits 11 to 8 bits 7 to 4 bits 3 to 0 ipra tmu0 tmu1 tmu2 rtc iprb wdt ref sci0 reserved * iprc irq3 irq2 irq1 irq0 iprd pint0 to pint7 pint8 to pint15 irq5 irq4 ipre dmac irda scif adc note: * always read as 0. only 0 should be written in. as shown in table 6.7, four sets of on-chip peripheral module, irq, or pint interrupts are assigned to each register. 4-bit groups (bits 15 to 12, bits 11 to 8, bits 7 to 4, and bits 3 to 0) are set with values from h'0 (0000) to h'f (1111). setting h'0 means priority level 0 (masking is requested); h'f is priority level 15 (the highest level). a reset initializes ipraCipre to h'0000. h'0 should be set into bits corresponding to an unused interrupt.
132 6.3.2 interrupt control register 0 (icr0) the interrupt control register 0 (icr0) is a 16-bit register that sets the input signal detection mode of the external interrupt input pin nmi and indicates the input signal level to the nmi pin. this register is initialized to h'0000 at power-on reset or manual reset, but is not initialized in standby mode. bit: 15 14 13 12 11 10 9 8 nmil nmie initial value: 0/1 * 00 00 0 00 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r note: * when nmi input is high: 1; when nmi input is low: 0. bit 15nmi input level (nmil): sets the level of the signal input at the nmi pin. this bit can be read to determine the nmi pin level. this bit cannot be modified. bit 15: nmil description 0 nmi input level is low 1 nmi input level is high bit 8nmi edge select (nmie): selects whether the interrupt request signal is detected on the falling or rising edge of nmi input. bit 8: nmie description 0 interrupt request signal is detected on falling edge of nmi input (initial value) 1 interrupt request signal is detected on rising edge of nmi input bits 14 to 9 and 7 to 0reserved: these bits are always read as 0. the write value should always be 0.
133 6.3.3 interrupt control register 1 (icr1) the interrupt control register 1 (icr1) is a 16-bit register that specifies the detection mode to external interrupt input pins, irq0 to irq5 individually: rising edge, falling edge, or low level. this register, initialized to h'4000 at power-on reset or manual reset, is not initialized in the standby mode. bits 15 and 13 must be cleared. write 1 to these bits is inhibited. bit: 15 14 13 12 11 10 9 8 mai irqlvl blmsk irlsen irq51s irq50s irq41s irq40s initial value: 0 1 0 0 0 0 0 0 r/w: r/w r/w r/w rw r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 irq31s irq30s irq21s irq20s irq11s irq10s irq01s irq00s initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 15mask all interrupts (mai): when set to 1, masks all interrupt requests when a low level is being input to the nmi pin. masks nmi interrupts in standby mode. bit 15: mai description 0 all interrupt requests are not masked when a low level is being input to the nmi pin (initial value) 1 all interrupt requests are masked when a low level is being input to the nmi pin bit 14interrupt request level detect (irqlvl): selects whether the irq3Cirq0 pins are used as four independent interrupt pins or as 15-level interrupt pins encoded as irl3 C irl0 . bit 14: irqlvl description 0 used as four independent interrupt request pins irq3Cirq0 1 used as encoded 15-level interrupt pins as irl3 C irl0 (initial value) bit 13bl bit mask (blmsk): specifies whether nmi interrupts are masked when the bl bit of the sr register is 1. bit 13: blmsk description 0 nmi interrupts are masked when the bl bit is 1 (initial value) 1 nmi interrupts are accepted regardless of the bl bit setting
134 bit 12 irls enable (irlsen): enable irls3 C irls0 pins. this bit is effective only when irqlvl bit is 1. bit 12: irlsen description 0 disable irls3 C irls0 pins (initial value) 1 enable irls3 C irls0 pins bits 11 and 10irq5 sense select (irq51s, irq50s): select whether the interrupt signal to the irq5 pin is detected at the rising edge, at the falling edge, or at low level. bit 11: irq51s bit 10: irq50s description 0 0 an interrupt request is detected at irq5 input falling edge (initial value) 1 an interrupt request is detected at irq5 input rising edge 1 0 an interrupt request is detected at irq5 input low level 1 reserved bits 9 and 8irq4 sense select (irq41s, irq40s): select whether the interrupt signal to the irq4 pin is detected at the rising edge, at the falling edge, or at low level. bit 9: irq41s bit 8: irq40s description 0 0 an interrupt request is detected at irq4 input falling edge (initial value) 1 an interrupt request is detected at irq4 input rising edge 1 0 an interrupt request is detected at irq4 input low level 1 reserved bits 7 and 6irq3 sense select (irq31s, irq30s): select whether the interrupt signal to the irq3 pin is detected at the rising edge, at the falling edge, or at low level. bit 7: irq31s bit 6: irq30s description 0 0 an interrupt request is detected at irq3 input falling edge (initial value) 1 an interrupt request is detected at irq3 input rising edge 1 0 an interrupt request is detected at irq3 input low level 1 reserved
135 bits 5 and 4irq2 sense select (irq21s, irq20s): select whether the interrupt signal to the irq2 pin is detected at the rising edge, at the falling edge, or at low level. bit 5: irq21s bit 4: irq20s description 0 0 an interrupt request is detected at irq2 input falling edge (initial value) 1 an interrupt request is detected at irq2 input rising edge 1 0 an interrupt request is detected at irq2 input low level 1 reserved bits 3 and 2irq1 sense select (irq11s, irq10s): select whether the interrupt signal to the irq1 pin is detected at the rising edge, at the falling edge, or at low level. bit 3: irq11s bit 2: irq10s description 0 0 an interrupt request is detected at irq1 input falling edge (initial value) 1 an interrupt request is detected at irq1 input rising edge 1 0 an interrupt request is detected at irq1 input low level 1 reserved bits 1 and 0irq0 sense select (irq01s, irq00s): select whether the interrupt signal to the irq0 pin is detected at the rising edge, at the falling edge, or at low level. bit 1: irq01s bit 0: irq00s description 0 0 an interrupt request is detected at irq0 input falling edge (initial value) 1 an interrupt request is detected at irq0 input rising edge 1 0 an interrupt request is detected at irq0 input low level 1 reserved
136 6.3.4 interrupt control register 2 (icr2) the interrupt control register 2 (icr2) is a 16-bit read/write register that sets the detection mode to external interrupt input pins pint0 to pint15. this register is initialized to h'0000 at power-on reset or manual reset, but is not initialized in software standby mode. bit: 15 14 13 12 11 10 9 8 pint15s pint14s pint13s pint14s pint11s pint10s pint9s pint8s initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pint7s pint6s pint5s pint4s pint3s pint2s pint1s pint0s initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 0pint15 to pint0 sense select (pint15s to pint0s): select whether interrupt request signals to pint15 to pint0 are detected at low levels or high levels. b its 15 to 0: pint15s to pint0s description 0 interrupt requests are detected at low level input to the pint pins (initial value) 1 interrupt requests are detected at high level input to the pint pins
137 6.3.5 pint interrupt enable register (pinter) the pint interrupt enable register (pinter) is a 16-bit read/write register that enables interrupt requests input to external interrupt input pins pint0 to pint15. this register is initialized to h'0000 at power-on reset or manual reset, but is not initialized in standby mode. bit: 15 14 13 12 11 10 9 8 pint15e pint14e pint13e pint12e pint11e pint10e pint9e pint8e initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pint7e pint6e pint5e pint4e pint3e pint2e pint1e pint0e initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 0pint15 to pint0 interrupt enable (pint15e to pint0e): enable whether the interrupt requests input to the pint15 to pint0 pins. b its 15 to 0: pint15e to pint0e description 0 disables pint input interrupt requests (initial value) 1 enables pint input interrupt requests when all or some of these pins, pint0Cpint15 are not used as an interrupt input, a bit corresponding to a pin unused as an interrupt request should be set to 0.
138 6.3.6 interrupt request register 0 (irr0) the interrupt request register 0 (irr0) is an 8-bit register that indicates interrupt requests from external input pins irq0 to irq5 and pint0 to pint15. this register is initialized to h'00 at power-on reset or manual reset, but is not initialized in standby mode. bit: 7 6 5 4 3 2 1 0 pint0r pint1r irq5r irq4r irq3r irq2r irq1r irq0r initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w when clearing irq5rCirq0r bit to 0, 0 should be written to the bit after the bit is set to 1 and the contents of 1 are read. only 0 can be written to irq5rCirq0r. bit 7pint0 to pint7 interrupt request (pint0r): indicates whether interrupt requests are input to pint0 to pint7 pins. b it 7: pint0r description 0 interrupt requests are not input to pint0 to pint7 pins (initial value) 1 interrupt requests are input to pint0 to pint7 pins. bit 6pint8 to pint15 interrupt request (pint1r): indicates whether interrupt requests are input to pint8 to pint15 pins. b it 6: pint1r description 0 interrupt requests are not input to pint8 to pint15 pins (initial value) 1 interrupt requests are input to pint8 to pint15 pins. bit 5irq5 interrupt request (irq5r): indicates whether an interrupt request is input to the irq5 pin. when edge detection mode is set for irq5, an interrupt request is cleared by clearing the irq5r bit. b it 5: irq5r description 0 an interrupt request is not input to irq5 pin (initial value) 1 an interrupt request is input to irq5 pin
139 bit 4irq4 interrupt request (irq4r): indicates whether an interrupt request is input to the irq4 pin. when edge detection mode is set for irq4, an interrupt request is cleared by clearing the irq4r bit. bit 4: irq4r description 0 an interrupt request is not input to irq4 pin (initial value) 1 an interrupt request is input to irq4 pin bit 3irq3 interrupt request (irq3r): indicates whether an interrupt request is input to the irq3 pin. when edge detection mode is set for irq3, an interrupt request is cleared by clearing the irq3r bit. bit 3: irq3r description 0 an interrupt request is not input to irq3 pin (initial value) 1 an interrupt request is input to irq3 pin bit 2irq2 interrupt request (irq2r): indicates whether an interrupt request is input to the irq2 pin. when edge detection mode is set for irq2, an interrupt request is cleared by clearing the irq2r bit. bit 2: irq2r description 0 an interrupt request is not input to irq2 pin (initial value) 1 an interrupt request is input to irq2 pin bit 1irq1 interrupt request (irq1r): indicates whether an interrupt request is input to the irq1 pin. when edge detection mode is set for irq1, an interrupt request is cleared by clearing the irq1r bit. bit 1: irq1r description 0 an interrupt request is not input to irq1 pin (initial value) 1 an interrupt request is input to irq1 pin bit 0irq0 interrupt request (irq0r): indicates whether an interrupt request is input to the irq0 pin. when edge detection mode is set for irq0, an interrupt request is cleared by clearing the irq0r bit. bit 0: irq0r description 0 an interrupt request is not input to irq0 pin (initial value) 1 an interrupt request is input to irq0 pin
140 6.3.7 interrupt request register 1 (irr1) the interrupt request register 1 (irr1) is an 8-bit read-only register that indicates whether dmac or irda interrupt requests are generated. this register is initialized to h'00 at power-on reset or manual reset, but is not initialized in software mode. bit: 7 6 5 4 3 2 1 0 txi1r bri1r rxi1r eri1r dei3r dei2r dei1r dei0r initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit 7txi1 interrupt request (txi1r): indicates whether a txi1 (irda) interrupt request is generated. bit 7: txi1 description 0 a txi1 interrupt request is not generated (initial value) 1 a txi1 interrupt request is generated bit 6bri1 interrupt request (bri1r): indicates whether a bri1 (irda) interrupt request is generated. bit 6: bri1r description 0 a bri1 interrupt request is not generated (initial value) 1 a bri1 interrupt request is generated bit 5rxi1 interrupt request (rxi1r): indicates whether an rxi1 (irda) interrupt request is generated. bit 5: rxi1r description 0 an rxi1 interrupt request is not generated (initial value) 1 an rxi1 interrupt request is generated bit 4eri1 interrupt request (eri1r): indicates whether an eri1 (irda) interrupt request is generated. bit 4: eri1r description 0 an eri1 interrupt request is not generated (initial value) 1 an eri1 interrupt request is generated
141 bit 3dei3 interrupt request (dei3r): indicates whether a dei3 (dmac) interrupt request is generated. b it 3: dei3r description 0 a dei3 interrupt request is not generated (initial value) 1 a dei3 interrupt request is generated bit 2dei2 interrupt request (dei2r): indicates whether a dei2 (dmac) interrupt request is generated. b it 2: dei2r description 0 a dei2 interrupt request is not generated (initial value) 1 a dei2 interrupt request is generated bit 1dei1 interrupt request (dei1r): indicates whether a dei1 (dmac) interrupt request is generated. b it 1: dei1r description 0 a dei1 interrupt request is not generated (initial value) 1 a dei1 interrupt request is generated bit 0dei0 interrupt request (dei0r): indicates whether a dei0 (dmac) interrupt request is generated. b it 0: dei0r description 0 a dei0 interrupt request is not generated (initial value) 1 a dei0 interrupt request is generated 6.3.8 interrupt request register 2 (irr2) the interrupt request register 2 (irr2) is an 8-bit read-only register that indicates whether a/d converter, or scif interrupt requests are generated. this register is initialized to h'00 at power-on reset, manual reset, or in hardware standby mode, but is not initialized in software standby mode. bit: 7 6 5 4 3 2 1 0 adir txi2r bri2r rxi2r eri2r initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r
142 bits 7 to 5reserved bits: these bits are always read as 0. the write value should always be 0. bit 4adi interrupt request (adir): indicates whether an adi (adc) interrupt request is generated. b it 4: adir description 0 an adi interrupt request is not generated (initial value) 1 an adi interrupt request is generated bit 3txi2 interrupt request (txi2r): indicates whether a txi2 (scif) interrupt request is generated. b it 3: txi2r description 0 a txi2 interrupt request is not generated (initial value) 1 a txi2 interrupt request is generated bit 2bri2 interrupt request (bri2r): indicates whether a bri2 (scif) interrupt request is generated. b it 2: bri2r description 0 a bri2 interrupt request is not generated (initial value) 1 a bri2 interrupt request is generated bit 1rxi2 interrupt request (rxi2r): indicates whether an rxi2 (scif) interrupt request is generated. b it 1: rxi2r description 0 an rxi2 interrupt request is not generated (initial value) 1 an rxi2 interrupt request is generated bit 0eri2 interrupt request (eri2r): indicates whether an eri2 (scif) interrupt request is generated. b it 0: eri2r description 0 an eri2 interrupt request is not generated (initial value) 1 an eri2 interrupt request is generated
143 6.4 intc operation 6.4.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.3 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest priority interrupt from the interrupt requests sent, following the priority levels set in interrupt priority registers a to e (ipra to ipre). lower priority interrupts are held pending. if two of these interrupts have the same priority level or if multiple interrupts occur within a single module, the interrupt with the highest default priority or the highest priority within its ipr setting unit (as indicated in table 6.4 and table 6.5) is selected. 3. the priority level of the interrupt selected by the interrupt controller is compared with the interrupt mask bits (i3Ci0) in the status register (sr) of the cpu. if the request priority level is higher than the level in bits i3Ci0, the interrupt controller accepts the interrupt and sends an interrupt request signal to the cpu. when the interrupt controller receives an interrupt, a low level is output from the irqout pin. 4. the cpu receives an interrupt at a break in instructions. 5. the interrupt source code is set in the interrupt event registers (intevt and intevt2). 6. the status register (sr) and program counter (pc) are saved to ssr and spc, respectively. 7. the block bit (bl), mode bit (md), and register bank bit (rb) in sr are set to 1. 8. the cpu jumps to the start address of the interrupt handler (the sum of the value set in the vector base register (vbr) and h'00000600). the interrupt handler may branch with the intevt register value as its offset in order to identify the interrupt source. this enables it to branch to the processing routine for the individual interrupt source. notes: 1. the interrupt mask bits (i3Ci0) in the status register (sr) are not changed by acceptance of an interrupt in the sh7709a. 2. irqout outputs a low level until the interrupt request is cleared. however, if the interrupt source is masked by an interrupt mask bit, the irqout pin returns to the high level. the level is output without regard to the bl bit. 3. the interrupt source flag should be cleared in the interrupt handler. the interrupt source flag should be cleared in the interrupt handler. to ensure that an interrupt request that should have been cleared is not inadvertently accepted again, read the source flag after it has been cleared, then wait for the interval shown in "time for priority decision and sr mask bit comparison" in table 6.8 before clearing the bl bit or executing an rte instruction.
144 yes yes yes yes yes yes yes yes yes yes yes yes yes no no no no no no no no no no no no no program execution state save sr to ssr; save pc to spc set interrupt cause in intevt, intevt2 set bl/md/rb bits in sr to 1 branch to exception handler interrupt generated? icr1.mai = 1? icr1.blmsk = 1? irqout = 1? nmi = low? nmi? nmi? sr. bl= 0 or sleepmode? level 14 interrupt? level 1 interrupt? i3Ci0 level 13 or lower? i3Ci0 level 0? level 15 interrupt? i3Ci0 level 14 or lower? i3Ci0: interrupt mask bits in status register (sr) figure 6.3 interrupt operation flowchart
145 6.4.2 multiple interrupts when multiple interrupts are used, the structure of the interrupt service routine should be as follows. 1. branch to a specific interrupt handler corresponding to a code set in intevt and intevt2. the code in intevt and intevt2 can be used as a branch-offset for branching to the specific handler. 2. clear the cause of the interrupt in each specific handler. 3. save ssr and spc to the memory. 4. clear the bl bit in sr, and set the accepted interrupt level in the interrupt mask bits in sr. 5. handle the interrupt. 6. execute the rte instruction. when these procedures are followed in order, an interrupt of higher priority than the one being handled can be accepted after clearing bl in step 4. figure 6.3 shows a sample interrupt operation flowchart. 6.5 interrupt response time the time from generation of an interrupt request until interrupt exception processing is performed and fetching of the first instruction of the exception handler is started (the interrupt response time) is shown in table 6.8. figure 6.4 shows an example of pipeline operation when an irl interrupt is accepted. when sr.bl is 1, interrupt exception processing is masked, and is kept waiting until completion of an instruction that clears bl to 0.
146 table 6.8 interrupt response time number of states item nmi irq pint peripheral modules notes time for priority decision and sr mask bit comparison 0.5 icyc + 0.5 bcyc + 0.5 pcyc 0.5 icyc + 1 bcyc + 4.5 pcyc * 4 0.5 icyc + 3.5 pcyc 0.5 icyc + 1.5 pcyc * 6 0.5 icyc + 1 bcyc + 2.5 pcyc * 5 0.5 icyc + 3 pcyc * 7 wait time until end of sequence being executed by cpu x ( 0) icyc x ( 0) icyc x ( 0) icyc x ( 0) icyc interrupt exception processing is kept waiting until the executing instru- ction ends. if the number of instruc- tion execution states is s * 1 , the maximum wait time is: x = s C 1. however, if bl is set to 1 by instruc- tion execution or by an exception, interrupt exception processing is deferred until completion of an instruction that clears bl to 0. if the following instruction masks interrupt exception processing, the processing may be further deferred. time from interrupt exception processing (save of sr and pc) until fetch of first instruction of exception service routine is started 5 icyc 5 icyc 5 icyc 5 icyc
147 table 6.8 interrupt response time (cont) number of states item nmi irq pint peripheral modules notes response time total (5.5 + x) icyc + 0.5 bcyc + 0.5 pcyc (5.5 + x) icyc + 1 bcyc + 2.5 pcyc * 6 (5.5 + x) icyc + 1.5 pcyc * 6 (5.5 + x) icyc + 1.5 pcyc * 6 (5.5 + x) icyc + 3 pcyc * 5 (5.5 + x) icyc + 3 pcyc * 7 (5.5 + x) icyc + 3 pcyc * 7 minimum case * 2 7.5 16.5 12.5 8.5 * 6 /11.5 * 7 at 60-mhz (ckio = 30) operation: 0.13C0.28 s maximum case * 3 7 + s 26.5 + s 18.5 + s 10.5 + s * 6 16.5 + s * 7 at 60-mhz (ckio = 15) operation: 0.26C0.56 s (in case of operand cache hit) at 60-mhz (ckio = 15) operation: 0.29C0.59 s (when external memory access is performed with wait = 0) icyc: duration of one cycle of internal clock supplied to cpu. bcyc: duration of one ckio cycle. pcyc: duration of one cycle of peripheral clock supplied to peripheral modules. notes: * 1 s also includes the memory access wait time. the processing requiring the maximum execution time is ldc.l @rm+, sr. when the memory access is a cache-hit, this requires seven instruction execution cycles. when the external access is performed, the corresponding number of cycles must be added. there are also instructions that perform two external memory accesses; if the external memory access is slow, the number of instruction execution cycles will increase accordingly. * 2 the internal clock: ckio: peripheral clock ratio is 2: 1: 1. * 3 the internal clock: ckio: peripheral clock ratio is 4: 1: 1. * 4 irq mode * 5 irl mode * 6 modules: tmu, rtc, sci, wdt, refc * 7 modules: dmac, adc, irda, scif
148 interrupt acceptance irl 0.5 icyc + 0.5 bcyc + 2 pcyc instruction (instruction replaced by interrupt exception processing) if id ex ex ex ex if if id ex 5 icyc start of interrupt processing if: instruction fetch: instruction is fetched from memory in which program is stored. id: instruction decode: fetched instruction is decoded. ex: instruction execution: data operation and address calculation are performed in accordance with result of decoding. overrun fetch first instruction of interrupt handler figure 6.4 example of pipeline operations when irl interrupt is accepted
149 section 7 user break controller 7.1 overview the user break controller (ubc) provides functions that simplify program debugging. break conditions are set in the ubc and a user break is generated according to the conditions of the bus cycle generated by the cpu or on-chip dmac. the breakpoint check function monitors instruction fetches and operand read/writes, generating a variable combination of pre-execution instruction fetch, post-execution instruction fetch, and post-execution operand access breakpoint traps under designated read/write conditions. this function makes it easy to design an effective self-monitoring debugger, enabling the chip to debug programs without using an in-circuit emulator. 7.1.1 features the user break controller has the following features: ? the following break comparison conditions can be set. number of break channels: two channels (channels a and b) user break can be requested as either the independent or sequential condition on channels a and b (sequential break setting: channel a and, then channel b match with logical and, but not in the same bus cycle). ? address (compares 40 bits comprised of a 32-bit logical address prefixed with an asid address comparison bits are maskable in 32-bit units, user can easily program it to mask addresses at bottom 12 bits (4-k page), bottom 10 bits (1-k page), or any size of page, etc. the 8-bit asid checking is from mmu control to indicate hit or not hit.) one of four address buses (cpu address bus (lab), cache address bus (iab), x-memory address bus (xab) and y-memory address bus (yab)) can be selected. ? data (only on channel b, 32-bit maskable) one of the four data buses (cpu data bus (ldb), cache data bus (idb), x-memory data bus (xdb) and y-memory data bus (ydb)) can be selected. ? bus master: cpu cycle or dmac cycle ? bus cycle: instruction fetch or data access ? read/write ? operand size: byte, word, or longword ? user break is generated upon satisfying break conditions. a user-designed user-break condition exception processing routine can be run.
150 ? in an instruction fetch cycle, it can be selected that a break is set before or after an instruction is executed. ? breaks can be specified for on-chip i/o accesses or ldtlb instruction execution in ase mode. ? the number of repeat times can be specified as a break condition. (it is only for channel b) ? maximum repeat times for the break condition: 2 12 C 1 times. ? eight pairs of branch source/destination buffers.
151 7.1.2 block diagram bbra bara bamra basra 
comparator cpu state signals xabyab iab lab mdb access comparator address comparator channel a asid comparator   comparator address comparator data comparator pc trace control channel b bbrb betr    
     
    '()*    ccn location ldb/idb/ xdb/ydb access control legend bbra: break bus cycle register a bara: break address register a bamra: break address mask register a basra: break asid register a bbrb: break bus cycle register b barb: break address register b bamrb: break address mask register b basrb: break asid register b bdrb: break data register b bdmrb: break data mask register b betr: break execution times register brsr: branch source register brdr: branch destination register brcr: break control register figure 7.1 block diagram of user break controller
152 7.1.3 register configuration table 7.1 register configuration name abbr. r/w initial value * 1 address access size location break address register a bara r/w h'00000000 h'ffffffb0 32 ubc break address mask register a bamra r/w h'00000000 h'ffffffb4 32 ubc break bus cycle register a bbra r/w h'0000 h'ffffffb8 16 ubc break address register b barb r/w h'00000000 h'ffffffa0 32 ubc break address mask register b bamrb r/w h'00000000 h'ffffffa4 32 ubc break bus cycle register b bbrb r/w h'0000 h'ffffffa8 16 ubc break data register b bdrb r/w h'00000000 h'ffffff90 32 ubc break data mask register b bdmrb r/w h'00000000 h'ffffff94 32 ubc break control register brcr r/w h'00000000 h'ffffff98 32 ubc execution count break register betr r/w h'0000 h'ffffff9c 16 ubc branch source register brsr r undefined * 2 h'ffffffac 32 ubc branch destination register brdr r undefined * 2 h'ffffffbc 32 ubc break asid register a basra r/w undefined h'ffffffe4 16 ccn break asid register b basrb r/w undefined h'ffffffe8 16 ccn notes: * 1 initialized by power-on reset. values held in standby state and undefined by manual resets. * 2 bit 31 of brsr and brdr (valid flag) is initialized by power-on resets. but other bits are not initialized.
153 7.2 register descriptions 7.2.1 break address register a (bara) bara is a 32-bit read/write register. bara specifies the address used as a break condition in channel a. a power-on reset initializes bara to h'00000000. bit: 31 30 29 28 27 26 25 24 baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 0break address a31 to a0 (baa31 to baa0): stores the address on the lab or iab specifying break conditions of channel a.
154 7.2.2 break address mask register a (bamra) bamra is a 32-bit read/write register. bamra specifies bits masked in the break address specified by bara. a power-on reset initializes bamra to h'00000000. bit: 31 30 29 28 27 26 25 24 bama31 bama30 bama29 bama28 bama27 bama26 bama25 bama24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bama23 bama22 bama21 bama20 bama19 bama18 bama17 bama16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bama15 bama14 bama13 bama12 bama11 bama10 bama9 bama8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bama7 bama6 bama5 bama4 bama3 bama2 bama1 bama0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 0break address mask register a31 to a0 (bama31 to bama0): specifies bits masked in the channel a break address bits specified by bara (baa31Cbaa0). bits 31 to 0: baman description 0 break address bit baan of channel a is included in the break condition (initial value) 1 break address bit baan of channel a is masked and is not included in the break condition n = 31C0
155 7.2.3 break bus cycle register a (bbra) break bus cycle register a (bbra) is a 16-bit read/write register, which specifies (1) cpu cycle or dmac cycle, (2) instruction fetch or data access, (3) read or write, and (4) operand size in the break conditions of channel a. a power-on reset initializes bbra to h'0000. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 cda1 cda0 ida1 ida0 rwa1 rwa0 sza1 sza0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 8reserved: these bits are always read as 0. the write value should always be 0. bits 7 and 6cpu cycle/dmac cycle select a (cda1, cda0): selects the cpu cycle or dmac cycle as the bus cycle of the channel a break condition. bit 7: cda1 bit 6: cda0 description 0 0 condition comparison is not performed (initial value) * 1 the break condition is the cpu cycle 1 0 the break condition is the dmac cycle * : dont care bits 5 and 4instruction fetch/data access select a (ida1, ida0): selects the instruction fetch cycle or data access cycle as the bus cycle of the channel a break condition. bit 5: ida1 bit 4: ida0 description 0 0 condition comparison is not performed (initial value) 1 the break condition is the instruction fetch cycle 1 0 the break condition is the data access cycle 1 the break condition is the instruction fetch cycle or data access cycle
156 bits 3 and 2read/write select a (rwa1, rwa0): selects the read cycle or write cycle as the bus cycle of the channel a break condition. bit 3: rwa1 bit 2: rwa0 description 0 0 condition comparison is not performed (initial value) 1 the break condition is the read cycle 1 0 the break condition is the write cycle 1 the break condition is the read cycle or write cycle bits 1 and 0operand size select a (sza1, sza0): selects the operand size of the bus cycle for the channel a break condition. bit 1: sza1 bit 0: sza0 description 0 0 the break condition does not include operand size (initial value) 1 the break condition is byte access 1 0 the break condition is word access 1 the break condition is longword access
157 7.2.4 break address register b (barb) barb is a 32-bit read/write register. barb specifies the address used as a break condition in channel b. a power-on reset initializes barb to h'00000000. bit: 31 30 29 28 27 26 25 24 bab31 bab30 bab29 bab28 bab27 bab26 bab25 bab24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
158 7.2.5 break address mask register b (bamrb) bamrb is a 32-bit read/write register. bamrb specifies bits masked in the break address specified by barb. a power-on reset initializes bamrb to h'00000000. bit: 31 30 29 28 27 26 25 24 bamb31 bamb30 bamb29 bamb28 bamb27 bamb26 bamb25 bamb24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bamb23 bamb22 bamb21 bamb20 bamb19 bamb18 bamb17 bamb16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bamb15 bamb14 bamb13 bamb12 bamb11 bamb10 bamb9 bamb8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bamb7 bamb6 bamb5 bamb4 bamb3 bamb2 bamb1 bamb0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 0break address mask register b31 to b0 (bamb31 to bamb0): specifies bits masked in the channel b break address bits specified by barb (bab31bab0). bits 31 to 0: bambn description 0 break address babn of channel b is included in the break condition (initial value) 1 break address babn of channel b is masked and is not included in the break condition n = 31 to 0
159 7.2.6 break data register b (bdrb) bdrb is a 32-bit read/write register. a power-on reset initializes bdrb to h'00000000. bit: 31 30 29 28 27 26 25 24 bdb31 bdb30 bdb29 bdb28 bdb27 bdb26 bdb25 bdb24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bdb23 bdb22 bdb21 bdb20 bdb19 bdb18 bdb17 bdb16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bdb15 bdb14 bdb13 bdb12 bdb11 bdb10 bdb9 bdb8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bdb7 bdb6 bdb5 bdb4 bdb3 bdb2 bdb1 bdb0 initial value: 0 0 0 0 0 0 0 0
160 7.2.7 break data mask register b (bdmrb) bdmrb is a 32-bit read/write register. bdmrb specifies bits masked in the break data specified by bdrb. a power-on reset initializes bdmrb to h'00000000. bit: 31 30 29 28 27 26 25 24 bdmb31 bdmb30 bdmb29 bdmb28 bdmb27 bdmb26 bdmb25 bdmb24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bdmb23 bdmb22 bdmb21 bdmb20 bdmb19 bdmb18 bdmb17 bdmb16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bdmb15 bdmb14 bdmb13 bdmb12 bdmb11 bdmb10 bdmb9 bdmb8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bdmb7 bdmb6 bdmb5 bdmb4 bdmb3 bdmb2 bdmb1 bdmb0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 0break data mask register b31 to b0 (bdmb31 to bdmb0): specifies bits in the channel b break data bits specified by bdrb (bdb31bdb0). bits 31 to 0: bdmbn description 0 break data bdbn of channel b is included in the break condition (initial value) 1 break data bdbn of channel b is masked and is not included in the break condition n = 31 to 0 notes: 1. specify an operand size when including the value of the data bus in the break condition. 2. when a byte size is selected as a break condition, the break data must be set in bits 15-8 in bdrb for an even break address and bits 7-0 for an odd break address. another 8 bits have no influence on a break condition.
161 7.2.8 break bus cycle register b (bbrb) break bus cycle register b (bbrb) is a 16-bit read/write register, which specifies, (1) cpu cycle or dmac cycle, (2) instruction fetch or data access, (3) read/write, and (4) operand size in the break conditions of channel b. a power-on reset initializes bbrb to h'0000. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 cdb1 cdb0 idb1 idb0 rwb1 rwb0 szb1 szb0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 8reserved: these bits are always read as 0. these bits are always read as 0. bits 7 and 6cpu cycle/dmac cycle select b (cdb1, cdb0): select the cpu cycle or dmac cycle as the bus cycle of the channel b break condition. bit 7: cdb1 bit 6: cdb0 description 0 0 condition comparison is not performed (initial value) * 1 the break condition is the cpu cycle 1 0 the break condition is the dmac cycle * : dont care bits 5 and 4instruction fetch/data access select b (idb1, idb0): select the instruction fetch cycle or data access cycle as the bus cycle of the channel b break condition. bit 5: idb1 bit 4: idb0 description 0 0 condition comparison is not performed (initial value) 1 the break condition is the instruction fetch cycle 1 0 the break condition is the data access cycle 1 the break condition is the instruction fetch cycle or data access cycle
162 bits 3 and 2read/write select b (rwb1, rwb0): select the read cycle or write cycle as the bus cycle of the channel b break condition. bit 3: rwb1 bit 2: rwb0 description 0 0 condition comparison is not performed (initial value) 1 the break condition is the read cycle 1 0 the break condition is the write cycle 1 the break condition is the read cycle or write cycle bits 1 and 0operand size select b (szb1, szb0): select the operand size of the bus cycle for the channel b break condition. bit 1: szb1 bit 0: szb0 description 0 0 the break condition does not include operand size (initial value) 1 the break condition is byte access 1 0 the break condition is word access 1 the break condition is longword access
163 7.2.9 break control register (brcr) brcr sets the following conditions: 1. channels a and b are used in two independent channels condition or under the sequential condition. 2. a break is set before or after instruction execution. 3. a break is set by the number of execution times. 4. determine whether to include data bus on channel b in comparison conditions. 5. enable pc trace. 6. enable the asid check. the break control register (brcr) is a 32-bit read/write register that has break conditions match flags and bits for setting a variety of break conditions. a power-on reset initializes brcr to h'00000000. bit: 31 30 29 28 27 26 25 24 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 basma basmb initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r r r r bit:151413121110 9 8 scmfca scmfcb scmfda scmfdb pcte pcba initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r r bit: 7 6 5 4 3 2 1 0 dbeb pcbb seq etbe initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r r r/w r r r/w bits 31 to 22reserved: these bits are always read as 0. the write value should always be 0.
164 bit 21break asid mask a (basma): specifies whether the bits of the channel a break asid7-asid0 (basa7 to basa0) set in basra are masked or not. bit 21: basma description 0 all basra bits are included in break condition, asid is checked (initial value) 1 no basra bits are included in break condition, asid is not checked bit 20break asid mask b (basmb): specifies whether the bits of channel b break asid7- asid0 (basb7 to basb0) set in basrb are masked or not. bit 20: basmb description 0 all basrb bits are included in break condition, asid is checked (initial value) 1 no basrb bits are included in break condition, asid is not checked bits 19 to 16reserved: these bits are always read as 0. the write value should always be 0. bit 15cpu condition match flag a (scmfca): when the cpu bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0 into this bit. bit 15: scmfca description 0 the cpu cycle condition for channel a does not match (initial value) 1 the cpu cycle condition for channel a matches bit 14cpu condition match flag b (scmfcb): when the cpu bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0 into this bit. bit 14: scmfcb description 0 the cpu cycle condition for channel b does not match (initial value) 1 the cpu cycle condition for channel b matches
165 bit 13dmac condition match flag a (scmfda): when the on-chip dmac bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0 into this bit. bit 13: scmfda description 0 the dmac cycle condition for channel a does not match (initial value) 1 the dmac cycle condition for channel a matches bit 12dmac condition match flag b (scmfdb): when the on-chip dmac bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0 into this bit. bit 12: scmfdb description 0 the dmac cycle condition for channel b does not match (initial value) 1 the dmac cycle condition for channel b matches bit 11pc trace enable (pcte): enables pc trace. bit 11: pcte description 0 disables pc trace (initial value) 1 enables pc trace bit 10pc break select a (pcba): selects the break timing of the instruction fetch cycle for channel a as before or after instruction execution. bit 10: pcba description 0 pc break of channel a is set before instruction execution (initial value) 1 pc break of channel a is set after instruction execution bits 9 and 8reserved: these bits are always read as 0. the write value should always be 0. bit 7data break enable b (dbeb): selects whether or not the data bus condition is included in the break condition of channel b. bit 7: dbeb description 0 no data bus condition is included in the condition of channel b (initial value) 1 the data bus condition is included in the condition of channel b
166 bit 6pc break select b (pcbb): selects the break timing of the instruction fetch cycle for channel b as before or after instruction execution. bit 6: pcbb description 0 pc break of channel b is set before instruction execution (initial value) 1 pc break of channel b is set after instruction execution bits 5 and 4reserved: these bits are always read as 0. the write value should always be 0. bit 3sequence condition select (seq): selects two conditions of channels a and b as independent or sequential. bit 3: seq description 0 channels a and b are compared under the independent condition (initial value) 1 channels a and b are compared under the sequential condition bit 2nprot bit: indicates whether to release ubc to user. this bit is meaningless in the main chip mode. the reading of brcr.nprot bit could be impossible in the ase break mode if the value is 1 because the mode has switched to the ase user mode. bit 2: nprot description 0 ubc is not released to user (initial value) 1 ubc is released to user bit 1rtb interrupt mask (rtbmk): indicates whether to mask user interrupts after rtb. this bit is meaningless in the main chip mode. bit 1: rtbmk description 0 interrupts are accepted after rtb (initial value) 1 interrupts are not accepted after rtb bit 0the number of execution times break enable (etbe): enable the execution-times break condition only on channel b. if this bit is 1 (break enable), a user break is issued when the number of break conditions matches with the number of execution times that is specified by the betr register. bit 0: etbe description 0 the execution-times break condition is masked on channel b (initial value) 1 the execution-times break condition is enabled on channel b
167 7.2.10 execution times break register (betr) when the execution-times break condition of channel b is enabled, this register specifies the number of execution times to make the break. the maximum number is 2 12 C 1 times. a power-on reset initializes betr to h'0000. when a break condition is satisfied, it decreases the betr. a break is issued when the break condition is satisfied after the betr becomes h'0001. bits 15-12 are always read as 0 and 0 should always be written in these bits. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
168 7.2.11 branch source register (brsr) brsr is a 32-bit read register. brsr stores the last fetched address before branch and the pointer (3 bits) which indicates the number of cycles from fetch to execution for the last executed instruction. brsr has the flag bit that is set to 1 when branch occurs. this flag bit is cleared to 0, when brsr is read and also initialized by power-on resets or manual resets. other bits are not initialized by reset. four brsr registers have queue structure and a stored register is shifted every branch. bit: 31 30 29 28 27 26 25 24 svf pid2 pid1 pid0 bsa27 bsa26 bsa25 bsa24 initial value: 0 ** ** * ** r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 bsa23 bsa22 bsa21 bsa20 bsa19 bsa18 bsa17 bsa16 initial value: ******** r/w: r r r r r r r r bit: 15 14 13 12 11 10 9 8 bsa15 bsa14 bsa13 bsa12 bsa11 bsa10 bsa9 bsa8 initial value: ******** r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bsa7 bsa6 bsa5 bsa4 bsa3 bsa2 bsa1 bsa0 initial value: ******** r/w: r r r r r r r r note: * undefined value bit 31brsr valid flag (svf): indicates whether the address and the pointer by which the branch source address can be calculated. when a branch source address is fetched, this flag is set to 1. this flag is cleared to 0 in reading brsr. bit 31: svf description 0 the value of brsr register is invalid 1 the value of brsr register is valid
169 bits 30 to 28instruction decode pointer (pid2 to pid0): pid is a 3-bit binary pointer (0C7). these bits indicate the instruction buffer number which stores the last executed instruction before branch. bits 30 to 28: pid description even pid indicates the instruction buffer number. odd pid+2 indicates the instruction buffer number bits 27 to 0branch source address (bsa27Cbsa0): these bits store the last fetched address before branch. 7.2.12 branch destination register (brdr) brdr is a 32-bit read register. brdr stores the branch destination fetch address. brdr has the flag bit that is set to 1 when branch occurs. this flag bit is cleared to 0, when brdr is read and also initialized by power-on resets or manual resets. other bits are not initialized by resets. four brdr registers have queue structure and a stored register is shifted every branch. bit: 31 30 29 28 27 26 25 24 dvf bda27 bda26 bda25 bda24 initial value: 0 ** ** * ** r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 bda23 bda22 bda21 bda20 bda19 bda18 bda17 bda16 initial value: ******** r/w: r r r r r r r r bit: 15 14 13 12 11 10 9 8 bda15 bda14 bda13 bda12 bda11 bda10 bda9 bda8 initial value: ******** r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bda7 bda6 bda5 bda4 bda3 bda2 bda1 bda0 initial value: ******** r/w: r r r r r r r r note: * undefined value
170 bit 31brdr valid flag (dvf): indicates whether a branch destination address is stored. when a branch destination address is fetched, this flag is set to 1. this flag is set to 0 in reading brdr. bit 31: dvf description 0 the value of brdr register is invalid 1 the value of brdr register is valid bits 30 to 28reserved: these bits are always read as 0. the write value should always be 0. bits 27 to 0branch destination address (bda27 to bda0): these bits store the first fetched address after branch. 7.2.13 break asid register a (basra) break asid register a (basra) is an 8-bit read/write register that specifies the asid that serves as the break condition for channel a. it is not initialized by resets. it is located in ccn. bit: 7 6 5 4 3 2 1 0 basa7 basa6 basa5 basa4 basa3 basa2 basa1 basa0 initial value: ******** r/w: r/w r/w r/w r/w r/w r/w r/w r/w note: * undefined value bits 7 to 0break asid a7 to 0 (basa7 to basa0): these bits store the asid (bits 7 to 0) that is the channel a break condition. 7.2.14 break asid register b (basrb) break asid register b (basrb) is an 8-bit read/write register that specifies the asid that serves as the break condition for channel b. it is not initialized by resets. it is located in ccn. bit: 7 6 5 4 3 2 1 0 basb7 basb6 basb5 basb4 basb3 basb2 basb1 basb0 initial value: ******** r/w: r/w r/w r/w r/w r/w r/w r/w r/w note: * undefined value bits 7 to 0break asid a7 to 0 (basb7 to basb0): these bits store the asid (bits 7 to 0) that is the channel b break condition.
171 7.3 operation description 7.3.1 flow of the user break operation the flow from setting of break conditions to user break exception processing is described below: 1. the break addresses and the corresponding asids are loaded in the break address registers (bara and barb) and break asid registers (basra and basrb in ccn). the masked addresses are set in the break address mask registers (bamra and bamrb). the break data is set in the break data register (bdrb). the masked data is set in the break data mask register (bdmrb). the breaking bus conditions are set in the break bus cycle registers (bbra and bbrb). three groups of the bbra and bbrb (cpu cycle/dmac cycle select, instruction fetch/data access select, and read/write select) are each set. no user break will be generated if even one of these groups is set with 00. the respective conditions are set in the bits of the brcr. 2. when the break conditions are satisfied, the ubc sends a user break request to the interrupt controller. the break type will be sent to cpu indicating the instruction fetch, pre/post instruction break, data access break, or on-chip i/o access/ldtlb break. when conditions match up, the cpu condition match flags (scmfca and scmfcb) and dmac condition match flags (scmfda and scmfdb) for the respective channels are set. 3. when the ase mode is set (not in the main chip mode) and the set conditions are satisfied, the ubc sends an ase break request to interrupt controller. when conditions match up, the corresponding match flags (scmfiob and scmfldt) or other flags are set. 4. the appropriate condition match flags (scmfca, scmfda, scmfcb, and scmfdb) can be used to check if the set conditions match or not. the matching of the conditions sets flags, but they are not reset. 0 must first be written to them before they can be used again. 5. there is a chance that the data access break and its following instruction fetch break occur around the same time, there will be only one break request to the cpu, but these two break channel match flags could be both set.
172 7.3.2 break on instruction fetch cycle 1. when cpu/instruction fetch/read/word or longword is set in the break bus cycle registers (bbra/bbrb), the break condition becomes the cpu instruction fetch cycle. whether it then breaks before or after the execution of the instruction can then be selected with the pcba/pcbb bits of the break control register (brcr) for the appropriate channel. 2. an instruction set for a break before execution breaks when it is confirmed that the instruction has been fetched and will be executed. this means this feature cannot be used on instructions fetched by overrun (instructions fetched at a branch or during an interrupt transition, but not to be executed). when this kind of break is set for the delay slot of a delay branch instruction, the break is generated prior to execution of the instruction that then first accepts the break. meanwhile, the break set for pre-instruction-break on delay slot instruction and post- instruction-break on sleep instruction are also prohibited. 3. when the condition is specified to be occurred after execution, the instruction set with the break condition is executed and then the break is generated prior to the execution of the next instruction. as with pre-execution breaks, this cannot be used with overrun fetch instructions. when this kind of break is set for a delay branch instruction, the break is generated at the instruction that then first accepts the break. 4. when an instruction fetch cycle is set for channel b, break data register b (bdrb) is ignored. there is thus no need to set break data for the break of the instruction fetch cycle. 7.3.3 break by data access cycle 1. the memory cycles in which cpu data access breaks occur are from instructions. 2. the relationship between the data access cycle address and the comparison condition for operand size are listed in table 7.2: table 7.2 data access cycle addresses and operand size comparison conditions access size address compared longword compares break address register bits 31C2 to address bus bits 31C2 word compares break address register bits 31C1 to address bus bits 31C1 byte compares break address register bits 31C0 to address bus bits 31C0 this means that when address h'00001003 is set without specifying the size condition, for example, the bus cycle in which the break condition is satisfied is as follows (where other conditions are met). longword access at h'00001000 word access at h'00001002 byte access at h'00001003
173 3. when the data value is included in the break conditions on b channel: when the data value is included in the break conditions, either longword, word, or byte is specified as the operand size of the break bus cycle registers (bbra and bbrb). when data values are included in break conditions, a break is generated when the address conditions and data conditions both match. to specify byte data for this case, set the same data in two bytes at bits 15C8 and bits 7C0 of the break data register b (bdrb) and break data mask register b (bdmrb). when word or byte is set, bits 31C16 of bdrb and bdmrb are ignored. 4. when the dmac data access is included in the break condition: when the address is included in the break condition on dmac data access, the operand size of the break bus cycle registers (bbra and bbrb) should be byte, word or no specified operand size. when the data value is included, select either byte or word. 7.3.4 sequential break 1. by specifying seq in brcr is set to 1, the sequential break is issued when channel b break condition matches after channel a break condition matches. a user break is ignored even if channel b break condition matches before channel a break condition matches. when channels a and b condition match at the same time, the sequential break is not issued. 2. in sequential break specification, internal/x/y bus can be selected and the execution times break condition can be also specified. for example, when the execution times break condition is specified, the break condition is satisfied at channel b condition match with betr = h'0001 after channel a condition match. 7.3.5 value of saved program counter the pc when a break occurs is saved to the spc in user breaks. the pc value saved is as follows depending on the type of break. 1. when instruction fetch (before instruction execution) is specified as a break condition: the value of the program counter (pc) saved is the address of the instruction that matches the break condition. the fetched instruction is not executed, and a break occurs before it. 2. when instruction fetch (after instruction execution) is specified as a break condition: the pc value saved is the address of the instruction to be executed following the instruction in which the break condition matches. the fetched instruction is executed, and a break occurs before the execution of the next instruction. 3. when data access (address only) is specified as a break condition: the pc value is the address of the instruction to be executed following the instruction that matched the break condition. the instruction that matched the condition is executed and the break occurs before the next instruction is executed.
174 4. when data access (address + data) is specified as a break condition: the pc value is the start address of the instruction that follows the instruction already executed when break processing started up. when a data value is added to the break conditions, the place where the break will occur cannot be specified exactly. the break will occur before the execution of an instruction fetched around the data access where the break occurred. 7.3.6 pc trace 1. setting pcte in brcr to 1 enables pc traces. when branch (branch instruction, repeat, and interrupt) is generated, the address from which the branch source address can be calculated and the branch destination address are stored in brsr and brdr, respectively. the branch address and the pointer, which corresponds to the branch, are included in brsr. 2. the branch address before branch occurs can be calculated from the address and the pointer stored in brsr. the expression from bsa (the address in brsr), pid (the pointer in brsr), and ia (the instruction address before branch occurs) is as follows: ia = bsa C 2 * pid. notes are needed when an interrupt (a branch) is issued before the branch destination instruction is executed. in case of the next figure, the instruction exec executed immediately before branch is calculated by ia = bsa C 2 * pid. however, when branch branch has delay slot and the destination address is 4n + 2 address, the address dest which is specified by branch instruction is stored in brsr (dest = bsa). therefore, as ia = bsa C 2 * pid is not applied to this case, this pid is invalid. the case where bsa is 4n + 2 boundary is applied only to this case and then some cases are classified as follows: exec:branch dest dest:instr (not executed) interrupt int: interrupt routine if the pid value is odd, instruction buffer indicates pid+2 buffer. however, these expressions in this table are accounted for it. therefore, the true branch source address is calculated with bsa and pid values stored in brsr. 3. the branch address before branch occurrence, ia, has different values due to some kinds of branch. a. branch instruction the branch instruction address b. interrupt the last instruction executed before interrupt the top address of interrupt routine is stored in brdr.
175 4. brsr and brdr have eight pairs of queue structures. the top of queues is read first when the address stored in the pc trace register is read. brsr and brdr share the read pointer. read brsr and brdr in order, the queue only shifts after brdr is read. when reading brdr, longword access should be used. also, the pc trace has a trace pointer, which initially points to the bottom of the queues. the first pair of branch addresses will be stored at the bottom of the queues, then push up when next pairs come into the queues. the trace pointer will points to the next branch address to be executed, unless it got push out of the queues. when the branch address has been executed, the trace pointer will shift down to next pair of addresses, until it reaches the bottom of the queues. after switching the pcte bit (in brcr) off and on, the values in the queues are invalid. the read pointer stay at the position before pcte is switched, but the trace pointer restart at the bottom of the queues. 7.3.7 usage examples break condition specified to a cpu instruction fetch cycle 1. register specifications bara = h'00000404, bamra = h'00000000, bbra = h'0054, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00300400 specified conditions: channel a/channel b independent mode ? channel a address: h'00000404, address mask: h'00000000 bus cycle: cpu/instruction fetch (after instruction execution)/read (operand size is not included in the condition) no asid check is included ? channel b address: h'00008010, address mask: h'00000006 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read (operand size is not included in the condition) no asid check is included a user break occurs after an instruction of address h'00000404 is executed or before instructions of adresses h'00008010 to h'00008016 are executed.
176 2. register specifications bara = h'00037226, bamra = h'00000000, bbra = h'0056, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008, basra = h'80, basrb = h'70 specified conditions: channel a/channel b sequence mode ? channel a address: h'00037226, address mask: h'00000000, asid = h'80 bus cycle: cpu/instruction fetch (before instruction execution)/read/word ? channel b address: h'0003722e, address mask: h'00000000, asid = h'70 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/word an instruction with asid = h'80 and address h'00037226 is executed, and a user break occurs before an instruction with asid = h'70 and address h'0003722e is executed. 3. register specifications bara = h'00027128, bamra = h'00000000, bbra = h'005a, barb = h'00031415, bamrb = h'00000000, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00300000 specified conditions: channel a/channel b independent mode ? channel a address: h'00027128, address mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/write/word no asid check is included ? channel b address: h'00031415, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read (operand size is not included in the condition) no asid check is included on channel a, no user break occurs since instruction fetch is not a write cycle. on channel b, no user break occurs since instruction fetch is performed for an even address.
177 4. register specifications bara = h'00037226, bamra = h'00000000, bbra = h'005a, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008, basra = h'80, basrb = h'70 specified conditions: channel a/channel b sequence mode ? channel a address: h'00037226, address mask: h'00000000, asid: h'80 bus cycle: cpu/instruction fetch (before instruction execution)/write/word ? channel b address: h'0003722e, address mask: h'00000000, asid: h'70 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/word since instruction fetch is not a write cycle on channel a, a sequence condition does not match. therefore, no user break occurs. 5. register specifications bara = h'00000500, bamra = h'00000000, bbra = h'0057, barb = h'00001000, bamrb = h'00000000, bbrb = h'0057, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00300001, betr = h'0005 specified conditions: channel a/channel b independent mode ? channel a address: h'00000500, address mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/longword ? channel b address: h'00001000, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/longword the number of execution-times break enable (5 times) on channel a, a user break occurs before an instruction of address h'00000500 is executed. on channel b, a user break occurs before the fifth instruction execution after instructions of address h'00001000 are executed four times.
178 6. register specifications bara = h'00008404, bamra = h'00000fff, bbra = h'0054, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000400, basra = h'80, basrb = h'70 specified conditions: channel a/channel b independent mode ? channel a address: h'00008404, address mask: h'00000fff bus cycle: cpu/instruction fetch (after instruction execution)/read (operand size is not included in the condition) ? channel b address: h'00008010, address mask: h'00000006, asid: h'70 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read (operand size is not included in the condition) a user break occurs after an instruction with asid = h'80 and address h'00008000 to h'00008ffe is executed or before instructions with asid = h'70 and addresses h'00008010 to h'00008016 are executed. break condition specified to a cpu data access cycle 1. register specifications bara = h'00123456, bamra = h'00000000, bbra = h'0064, barb = h'000abcde, bamrb = h'000000ff, bbrb = h'006a, bdrb = h'0000a512, bdmrb = h'00000000, brcr = h'00000080, basra = h'80, basrb = h'70 specified conditions: channel a/channel b independent mode ? channel a address: h'00123456, address mask: h'00000000 bus cycle: cpu/data access/read (operand size is not included in the condition) ? channel b address: h'000abcde, address mask: h'000000ff, asid: h'70 data: h'0000a512, data mask: h'00000000 bus cycle: cpu/data access/write/word on channel a, a user break occurs with asid = h'80 during longword read to address h'00123454, word read to address h'00123456, or byte read to address h'00123456. on channel b, a user break occurs with asid = h'70 when word h'a512 is written in addresses h'000abc00 to h'000abcfe.
179 break condition specified to a dmac data access cycle 1. register specifications: bara = h'00314156, bamra = h'00000000, bbra = h'0094, barb = h'00055555, bamrb = h'00000000, bbrb = h'00a9, bdrb = h'00000078, bdmrb = h'0000000f, brcr = h'00000080, basra = h'80, basrb = h'70 specified conditions: channel a/channel b independent mode ? channel a address: h'00314156, address mask: h'00000000, asid: h'80 bus cycle: dmac/instruction fetch/read (operand size is not included in the condition) ? channel b address: h'00055555, address mask: h'00000000, asid: h'70 data: h'00000078, data mask: h'0000000f bus cycle: dmac/data access/write/byte on channel a, no user break occurs since instruction fetch is not performed in dmac cycles. on channel b, a user break occurs with asid = h'70 when the dmac writes byte h'7* in address h'00055555. 7.3.8 notes 1. only cpu can read/write ubc registers. 2. ubc cannot monitor cpu and dmac access in the same channel. 3. notes in specification of sequential break are described below: a. a condition match occurs when b-channel match occurs in a bus cycle after an a-channel match occurs in another bus cycle in sequential break setting. therefore, no condition match occurs even if a bus cycle, in which an a-channel match and a channel b match occur simultaneously, is set. b. since the cpu has a pipeline configuration, the pipeline determines the order of an instruction fetch cycle and a memory cycle. therefore, when a channel condition matches in the order of bus cycles, a sequential condition is satisfied. c. when the bus cycle condition for channel a is specified as a break before execution (pcba = 0 in brcr) and an instruction fetch cycle (in bbra), the attention is as follows. a break is issued and condition match flags in brcr are set to 1, when the bus cycle conditions both for channels a and b match simultaneously. 4. the change of a ubc register value is executed in ma (memory access) stage. therefore, even if the break condition matches in the instruction fetch address following the instruction in which the pre-execution break is specified as the break condition, no break occurs. in order to know the timing ubc register is changed, read the last written register. instructions after then are valid for the newly written register value.
180 5. the branch instruction should not be executed as soon as pc trace register brsr and brdr are read. 6. when pc breaks and tlb exceptions or errors occur in the same instruction. the priority is as follows: a. break and instruction fetch exceptions: instruction fetch exception occurs first. b. break before execution and operand exception: break before execution occurs first. c. break after execution and operand exception: operand exception occurs first.
181 section 8 power-down modes 8.1 overview in the power-down modes, all cpu and some on-chip supporting module functions are halted. this lowers power consumption. 8.1.1 power-down modes the sh7709a has three power-down modes: 1. sleep mode 2. standby mode 3. module standby function (tmu, rtc, sci, ubc, dmac, dac, scif, and irda on-chip supporting modules) 4. hardware standby mode table 8.1 shows the transition conditions for entering the modes from the program execution state, as well as the cpu and supporting module states in each mode and the procedures for canceling each mode.
182 table 8.1 power-down modes state mode transition conditions cpg cpu cpu reg- ister on-chip memory on-chip peripheral modules pins external memory canceling procedure sleep mode execute sleep instruction with stby bit cleared to 0 in stbcr runs halts (reg- ister: held) held held run held refresh 1. interrupt 2. reset standby mode execute sleep instruction with stby bit set to 1 in stbcr halts halts (reg- ister: held) held held halt * 1 held self- refresh 1. interrupt 2. reset module standby function set mstp bit of stbcr and stbcr2 to 1 runs runs * 4 held held specified module halts * 2 refresh 1. clear mstp bit to 0 2. reset hardware standby mode drive ca pin low halts halts held held halt * 3 held self- refresh power-on reset notes: * 1 the rtc still runs if the start bit in rcr2 is set to 1 (see section 13, realtime clock (rtc)). tmu still runs when output of the rtc is used as input to its counter (see section 12, timer (tmu)). * 2 depends on the on-chip supporting module. tmu external pin: held sci external pin: reset * 3 the rtc still runs if the start bit in rcr2 is set to 1. tmu does not run. * 4 the cpu halts when sleep mode is entered. 8.1.2 pin configuration table 8.2 lists the pins used for the power-down modes. table 8.2 pin configuration pin name symbol i/o description processing state 1 status1 o operating state of the processor. processing state 0 status0 hh: reset, hl: sleep mode, lh: standby mode, ll: normal operation wakeup from standby mode wakeup o low active assert after accepting wakeup interrupt in standby mode until returning to normal operation with wdt overflow note: h means high level, and l means low level.
183 8.1.3 register configuration table 8.3 shows the configuration of the control register for the power-down modes. table 8.3 register configuration name abbreviation r/w initial value address access size standby control register stbcrr/w h'00 * h'ffffff82 8 standby control register 2 stbcr2 r/w h'00 * h'ffffff88 8 note: * initialized by power-on resets. this value is not initialized by manual resets but the contents are held. 8.2 register description 8.2.1 standby control register (stbcr) the standby control register (stbcr) is an 8-bit read/write register that sets the power-down mode. the stbcr is initialized to h'00 by a power-on reset. always set bits 6C3 to 0 when writing to the stbcr register. bit: 7 6 5 4 3 2 1 0 stby mstp2 mstp1 mstp0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r r r r/w r/w r/w bit 7standby (stby): specifies transition to standby mode. bit 7: stby description 0 executing sleep instruction puts the chip into sleep mode. (initial value) 1 executing sleep instruction puts the chip into standby mode. bits 6 to 3reserved: these bits are always read as 0. the write value should always be 0. bit 2module standby 2 (mstp2): specifies halting the clock supply to the timer unit tmu (an on-chip supporting module). when the mstp2 bit is set to 1, the supply of the clock to the tmu is halted. bit 2: mstp2 description 0 tmu runs. (initial value) 1 clock supply to tmu is halted.
184 bit 1module standby 1 (mstp1): specifies halting the clock supply to the realtime clock rtc (an on-chip supporting module). when the mstp1 bit is set to 1, the supply of the clock to rtc is halted. when the clock halts, all rtc registers become inaccessible, but the counter keeps running. bit 1: mstp1 description 0 rtc runs. (initial value) 1 clock supply to rtc is halted. bit 0module standby 0 (mstp0): specifies halting the clock supply to the serial communication interface sci (an on-chip supporting module). when the mstp0 bit is set to 1, the supply of the clock to the sci is halted. bit 0: mstp0 description 0 sci operates. (initial value) 1 clock supply to sci is halted. 8.2.2 standby control register 2 (stbcr2) the standby control register 2 (stbcr2) is a read/write 8-bit register that sets the power-down mode. the stbcr2 is initialized to h'00 during a power-on reset. bit: 7 6 5 4 3 2 1 0 mdchg mstp8 mstp7 mstp6 mstp5 mstp4 mstp3 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w bit 7reserved: this bit is always read as 0. the write value should always be 0. bit 6pin md5 to md0 control (mdchg): specifies whether or not pins md5 to md0 are changed in standby mode. when this bit is set to 1, the md5 to md0 pin values are latched when returning from standby mode by means of a reset or interrupt. bit 6: mdchg description 0 pins md5 to md0 are not changed in standby mode (initial value) 1 pins md5 to md0 are changed in standby mode
185 bit 5 module stop 8 (mstp8): specifies halting the clock supply to the user break controller ubc (an on-chip supporting module). when the mstp8 bit is set to 1, the supply of the clock to the ubc is halted. bit 5: mstp8 description 0 ubc runs (initial value) 1 clock supply to ubc is halted bit 4module stop 7 (mstp7): specifies halting of clock supply to the dmac (an on-chip peripheral module). when the mstp7 bit is set to 1, the supply of the clock to the dmac is halted. bit 4: mstp7 description 0 dmac runs (initial value) 1 clock supply to dmac halted bit 3module stop 6 (mstp6): specifies halting of clock supply to the dac (an on-chip peripheral module). when the mstp6 bit is set to 1, the supply of the clock to the dac is halted. bit 3: mstp6 description 0 dac runs (initial value) 1 clock supply to dac halted bit 2module stop 5 (mstp5): specifies halting of clock supply to the adc (an on-chip peripheral module). when the mstp5 bit is set to 1, the supply of the clock to the adc is halted. bit 2: mstp5 description 0 adc runs (initial value) 1 clock supply to adc halted bit 1module stop 4 (mstp4): specifies halting the clock supply to the serial communication interface with fifo (an on-chip peripheral module). when the mstp1 bit is set to 1, the supply of the clock to the scif is halted and all registers are initialized. bit 1: mstp4 description 0 scif runs (initial value) 1 clock supply to scif halted and all registers initialized
186 bit 0module stop 3 (mstp3): specifies halting the clock supply to the infrared data association interface with fifo (an on-chip peripheral module). when the mstp1 bit is set to 1, the supply of the clock to the irda is halted. bit 0: mstp3 description 0 irda runs (initial value) 1 clock supply to irda halted 8.3 sleep mode 8.3.1 transition to sleep mode executing the sleep instruction when the stby bit in stbcr is 0 causes a transition from the program execution state to sleep mode. although the cpu halts immediately after executing the sleep instruction, the contents of its internal registers remain unchanged. the on-chip supporting modules continue to run during sleep mode and the clock continues to be output to the ckio pin. in sleep mode, the status1 pin is set high and the status0 pin low. 8.3.2 canceling sleep mode sleep mode is canceled by an interrupt (nmi, irq, irl, on-chip supporting module, pint) or reset. interrupts are accepted during sleep mode even when the bl bit in the sr register is 1. if necessary, save spc and ssr in the stack before executing the sleep instruction. canceling with an interrupt: when an nmi, irq, irl or on-chip supporting module or pint interrupt occurs, sleep mode is canceled and interrupt exception processing is executed. a code indicating the interrupt source is set in the intevt and intevt2 registers. canceling with a reset: sleep mode is canceled by a power-on reset or a manual reset.
187 8.4 standby mode 8.4.1 transition to standby mode to enter standby mode, set the stby bit to 1 in stbcr, then execute the sleep instruction. the chip moves from the program execution state to standby mode. in standby mode, power consumption is greatly reduced by halting not only the cpu, but the clock and on-chip supporting modules as well. the clock output from the ckio pin also halts. cpu and cache register contents are held, but some on-chip supporting modules are initialized. table 8.4 lists the states of registers in standby mode. table 8.4 register states in standby mode module registers initialized registers retaining data interrupt controller (intc) all registers on-chip clock pulse generator (cpg) all registers user break controller (ubc) all registers bus state controller (bsc) all registers timer unit (tmu) tstr register registers other than tstr realtime clock (rtc) all registers a/d converter (adc) all registers d/a converter (dac) all registers the procedure for moving to standby mode is as follows: 1. clear the tme bit in the wdts timer control register (wtcsr) to 0 to stop the wdt. set the wdts timer counter (wtcnt) and the cks2Ccks0 bits of the wtcsr register to appropriate values to secure the specified oscillation settling time. 2. when pll circuit 1 is running in clock modes 3, 4, clear the pstby and pllen bits in the frequency control register (frqcr) to 0 to stop pll circuit 1. 3. after the stby bit in the stbcr register is set to 1, a sleep instruction is executed. 4. standby mode is entered and the clocks within the chip are halted. the status1 pin output goes low and the status0 pin output goes high.
188 8.4.2 canceling standby mode standby mode is canceled by an interrupt (nmi, irq, irl, pint, or on-chip supporting module) or a reset. canceling with an interrupt: the on-chip wdt can be used for hot starts. when the chip detects an nmi, irl, irq, pint, *1 or on-chip supporting module (except the interval timer) *2 interrupt, the clock will be supplied to the entire chip and standby mode canceled after the time set in the wdts timer control/status register has elapsed. the status1 and status0 pins both go low. interrupt processing then begins and a code indicating the interrupt source is set in the intevt and intevt2 registers. after branching to the interrupt processing routine occurs, clear the stby bit in the stbcr register. the wtcnt stops automatically. if the stby bit is not cleared, wtcnt continues operation and transits to the standby mode *3 when it reaches h80. at this time, a manual reset is not accepted while the wdt is running. interrupts are accepted during standby mode even when the bl bit in the sr register is 1. if necessary, save spc and ssr in the stack before executing the sleep instruction. immediately after an interrupt is detected, the phase of the clock output of the ckio pin may be unstable, until the processor starts interrupt processing. (the canceling condition is that the irl3Cirl0 level is higher than the mask level in the i3Ci0 bits in the sr register.) notes: *1 when the rtc is being used, standby mode can be canceled using irl3Cirl0, irq4C irq0, pint0Cpint15. *2 standby mode can be canceled with an rtc or tmu (only when running on the rtc clock) interrupt. *3 use a power-on reset to cancel standby mode. operation is not guaranteed in the case of a manual reset or interrupt input. wtcnt value h'ff h'80 time interrupt request wdt overflow and branch to interrupt handling routine crystal oscillator settling time and pll synchronization time clear bit stbcr.stby before wtcnt reaches h'80. when stbcr.stby is cleared, wtcnt   *( figure 8.1 canceling standby mode with stbcr.stby
189 canceling with a reset: standby mode can be canceled with a reset (power-on or manual). keep the resetp pin and resetm pin low until the clock oscillation settles. the internal clock will continue to be output to the ckio pin. 8.4.3 clock pause function in standby mode, the clock input from the extal pin or ckio pin can be halted and the frequency can be changed. this function is used as follows: 1. enter standby mode using the appropriate procedures. 2. once standby mode is entered and the clock stopped within the chip, the status1 pin output is low and the status0 pin output is high. 3. once the status1 pin goes low and the status0 pin goes high, the input clock is stopped or the frequency is changed. 4. when the frequency is changed, an nmi, irl , irq, pint or on-chip supporting module (except the internal timer) interrupt is input after the change. when the clock is stopped, the same interrupts are input after the clock is applied. 5. after the time set in the wdt has elapsed, the clock starts being applied internally within the chip, the status1Cstatus0 pins both go low, interrupts are handled, and operation resumes.
190 8.5 module standby function 8.5.1 transition to module standby function setting the standby control register mstp8Cmstp0 bits to 1 halts the supply of clocks to the corresponding on-chip supporting modules. this function can be used to reduce the power consumption in sleep mode. the module standby function holds the state prior to halt of the external pins of the on-chip supporting modules. tmu external pins hold their state prior to the halt. sci external pins go to the reset state. with a few exceptions, all registers hold their values. bit value description mstp8 0 ubc runs. 1 supply of clock to ubc halted. mstp7 0 dmac runs. 1 supply of clock to dmac halted. mstp6 0 dac runs. 1 supply of clock to dac halted. mstp5 0 adc runs. 1 supply of clock to adc halted, and all registers initialized. mstp4 0 scif runs. 1 supply of clock to scif halted. mstp3 0 irda runs. 1 supply of clock to irda halted. mstp2 0 tmu runs. 1 supply of clock to tmu halted. registers initialized. * 1 mstp1 0 rtc runs. 1 supply of clock to rtc halted. register access prohibited. * 2 mstp0 0 sci runs. 1 supply of clock to sci halted. notes: * 1 the registers initialized are the same as in the standby mode (table 8.4). * 2 the counter runs. 8.5.2 clearing the module standby function the module standby function can be cleared by clearing the mstp8Cmstp0 bits to 0, or by a power-on reset or manual reset.
191 8.6 timing of status pin changes the timing of status1 and status0 pin changes is shown in figures 8.2 through 8.10. 8.6.1 timing for resets power-on reset (clock modes 0, 1, 2, and 7): ckio resetp status normal normal reset pll settling time 0 to 5 bcyc 0 to 30 bcyc resetout note: reset: hh (status1 high, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle figure 8.2 power-on reset (clock modes 0, 1, 2, and 7) status output
192 power-on reset (clock modes 3 and 4): ckio resetp status normal normal reset 0 to 5 bcyc 0 to 30 bcyc resetout note: reset: hh (status1 high, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle figure 8.3 power-on reset (clock modes 3 and 4) status output manual reset: ckio resetm status normal normal reset 0 bcyc or more * 0 to 30 bcyc during manual reset, status becomes hh (reset) and the internal reset begins after waiting for the executing bus cycle to end. reset: hh (status1 high, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle note: * resetout figure 8.4 manual reset status output
193 8.6.2 timing for canceling standbys standby to interrupt: ckio status normal normal wdt count oscillation stops standby interrupt request wdt overflow wakeup note: standby: lh (status1 low, status0 high) normal: ll (status1 low, status0 low) figure 8.5 standby to interrupt status output standby to power-on reset: ckio status normal normal oscillation stops standby * 2 0 to 10 bcyc 0 to 30 bcyc reset reset resetp * 1 * 1 when standby mode is cleared with a power-on reset, the wdt does not count. keep resetp low during the plls oscillation settling time. * 2 undefined reset: hh (status1 high, status0 high) standby: lh (status1 low, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle notes: figure 8.6 standby to power-on reset status output
194 standby to manual reset: ckio status normal normal oscillation stops standby reset 0 to 20 bcyc reset resetm * note: * when standby mode is cleared with a manual reset, the wdt does not count. keep resetm low during the plls oscillation settling time. reset: hh (status1 high, status0 high) standby: lh (status1 low, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle figure 8.7 standby to manual reset status output 8.6.3 timing for canceling sleep mode sleep to interrupt: ckio status normal normal sleep interrupt request note: sleep: hl (status1 high, status0 low) normal: ll (status1 low, status0 low) figure 8.8 sleep to interrupt status output
195 sleep to power-on reset: ckio status normal normal sleep 0 to 10 bcyc 0 to 30 bcyc reset reset * 2 resetp * 1 * 1 when the pll1s multiplication ratio is changed by a power-on reset, keep resetp low during the plls oscillation settling time. * 2 undefined reset: hh (status1 high, status0 high) sleep: hl (status1 high, status0 low) normal: ll (status1 low, status0 low) bcyc: bus clock cycle notes: figure 8.9 sleep to power-on reset status output sleep to manual reset: ckio 0 to 80 bcyc 0 to 30 bcyc reset status normal normal sleep reset resetm * note: * keep resetm low until status becomes reset. reset: hh (status1 high, status0 high) sleep: hl (status1 high, status0 low) normal: ll (status1 low, status0 low) bcyc: bus clock cycle figure 8.10 sleep to manual reset status output
196 8.7 hardware standby function 8.7.1 transition to hardware standby mode driving the ca pin low causes a transition to hardware standby mode. in hardware standby mode, all modules except those operating on an rtc clock are halted, as in the standby mode entered on execution of a sleep instruction ((software) standby mode). hardware standby mode differs from (software) standby mode as follows. 1. interrupts and manual resets are not accepted. 2. the tmu does not operate. operation when a low-level signal is input at the ca pin depends on the cpg state, as follows. 1. in standby mode the clock remains stopped and the chip enters the hardware standby state. acceptance of interrupts and manual resets is disabled, tclk output is fixed low, and the tmu halts. 2. during wdt operation when standby mode is canceled by an interrupt the chip enters hardware standby mode after standby mode is canceled and the cpu resumes operation. 3. in sleep mode the chip enters hardware standby mode after sleep mode is canceled and the cpu resumes operation. 4. during pll standby (see section 9.6 for the pll standby function) the chip enters hardware standby mode after the pll turned off. hold the ca pin low in hardware standby mode.
197 8.7.2 canceling hardware standby mode hardware standby mode can only be canceled by a power-on reset. when the ca pin is driven high while the resetp pin is low, clock oscillation is started. hold the resetp pin low until clock oscillation stabilizes. when the resetp pin is driven high, the cpu begins power-on reset processing. if an interrupt or manual reset is input, correct operation cannot be guaranteed. 8.7.3 hardware standby mode timing figures 8.10 and 8.11 show examples of pin timing in hardware standby mode. the ca pin is sampled using extal2 (32.768 khz), and a hardware standby request is only recognized when the pin is low for two consecutive clock cycles. the ca pin must be held low while the chip is in hardware standby mode. clock oscillation starts when the ca pin is driven high after the resetp pin is driven low. normal status ca ckio standby reset resetp undefined rcyc: extal2 (32.768 khz) cycle 2 rcyc or more 0C10bcyc note: reset: hh (status1 high, status0 high) standby: lh (status1 low, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle rcyc: extal2 (32.768 khz) cycle figure 8.11 hardware standby mode (when ca goes low in normal operation)
198 normal status ca ckio standby reset resetp undefined 2 rcyc or more 0C10 bcyc standby wdt operation note: reset: hh (status1 high, status0 high) standby: lh (status1 low, status0 high) normal: ll (status1 low, status0 low) bcyc: bus clock cycle rcyc: extal2 (32.768 khz) cycle figure 8.12 hardware standby mode timing (when ca goes low during wdt operation on standby mode cancellation)
199 section 9 on-chip oscillation circuits 9.1 overview the on-chip oscillation circuits consist of a clock pulse generator (cpg) block and a watchdog timer (wdt) block. the cpg supplies all clocks to the processor and controls the power-down modes. the wdt is a single-channel timer that counts the clock settling time and is used when clearing standby mode and temporary standbys, such as frequency changes. it can also be used as an ordinary watchdog timer or interval timer. 9.1.1 features the cpg has the following features: ? six clock modes: selection of six clock modes for different frequency ranges, power consumption, direct crystal input, and external clock input. ? three clocks generated independently: an internal clock for the cpu, cache, and tlb (i ); a peripheral clock (p ) for the on-chip supporting modules; and a bus clock (ckio) for the external bus interface. ? frequency change function: internal and peripheral clock frequencies can be changed independently using the pll circuit and divider circuit within the cpg. frequencies are changed by software using frequency control register (frqcr) settings. ? pll on/off function: power consumption can be decreased by stopping the pll circuit when operating at low frequencies. ? power-down mode control: the clock can be stopped for sleep mode and standby mode and specific modules can be stopped using the module standby function. the wdt has the following features: ? can be used to ensure the clock settling time: use the wdt to cancel standby mode and the temporary standbys which occur when the clock frequency is changed. ? can switch between watchdog timer mode and interval timer mode. ? generates internal resets in watchdog timer mode: internal resets occur after counter overflow. selection of power-on reset or manual reset. ? generates interrupts in interval timer mode: internal timer interrupts occur after counter overflow. ? selection of eight counter input clocks. eight clocks ( 1 to 1/4096) can be obtained by dividing the peripheral clock.
200 9.2 overview of the cpg 9.2.1 cpg block diagram a block diagram of the on-chip clock pulse generator is shown in figure 9.1. cap1 ckio cycle = bcyc cap2 xtal extal md2 md1 md0 frqcr internal bus bus interface stbcr pll circuit 1 ( 1, 2, 3, 4, 6, 8) divider 1 internal clock (i ) cycle = icyc peripheral clock (p ) cycle = pcyc standby control divider 2 clock pulse generator pll circuit 2 ( 1, 4) crystal oscillator cpg control unit clock frequency control circuit standby control circuit 1 1/2 1/3 1/4 1/6 1 1/2 1/3 1/4 1/6 frqcr: frequency control register stbcr: standby control register legend: figure 9.1 block diagram of clock pulse generator
201 the clock pulse generator blocks function as follows: 1. pll circuit 1: pll circuit 1 doubles, triples, quadruples, sextuples, octuples, or leaves unchanged the input clock frequency from the ckio terminal. the multiplication rate is set by the frequency control register. when this is done, the phase of the leading edge of the internal clock is controlled so that it will agree with the phase of the leading edge of the ckio pin. 2. pll circuit 2: pll circuit 2 leaves unchanged or quadruples the frequency of the crystal oscillator or the input clock frequency coming from the extal pin. the multiplication ratio is fixed by the clock operation mode. the clock operation mode is set by pins md0, md1, and md2. see table 9.3 for more information on clock operation modes. 3. crystal oscillator: this oscillator is used when a crystal oscillator element is connected to the xtal and extal pins. it operates according to the clock operating mode setting. 4. divider 1: divider 1 generates a clock at the operating frequency used by the internal clock. the operating frequency can be 1, 1/2, 1/3, 1/4, or 1/6 times the output frequency of pll circuit 1, as long as it stays at or above the clock frequency of the ckio pin. the division ratio is set in the frequency control register. 5. divider 2: divider 2 generates a clock at the operating frequency used by the peripheral clock. the operating frequencies can be 1, 1/2, 1/3, 1/4, or 1/6 times the output frequency of pll circuit 1 or the clock frequency of the ckio pin, as long as it stays at or below the clock frequency of the ckio pin. the division ratio is set in the frequency control register. 6. clock frequency control circuit: the clock frequency control circuit controls the clock frequency using the md pin and the frequency control register. 7. standby control circuit: the standby control circuit controls the state of the clock pulse generator and other modules during clock switching and sleep/standby modes. 8. frequency control register: the frequency control register has control bits assigned for the following functions: clock output/non-output from the ckio pin, on/off control of pll circuit 1, pll standby, the frequency multiplication ratio of pll 1, and the frequency division ratio of the internal clock and the peripheral clock. 9. standby control register: the standby control register has bits for controlling the power-down modes. see section 8, power-down modes, for more information.
202 9.2.2 cpg pin configuration table 9.1 lists the cpg pins and their functions. table 9.1 clock pulse generator pins and functions pin name symbol i/o description mode control md0 i set the clock operating mode. pins md1 i md2 i crystal i/o pins xtal o connects a crystal oscillator. (clock input pins) extal i connects a crystal oscillator. also used to input an external clock. clock i/o pin ckio i/o inputs or outputs an external clock. level can be fixed during output. capacitor connection pins cap1 i connects capacitor for pll circuit 1 operation (recommended value 470 pf). for pll cap2 i connects capacitor for pll circuit 2 operation (recommended value 470 pf). 9.2.3 cpg register configuration table 9.2 shows the cpg register configuration. table 9.2 register configuration register name abbreviation r/w initial value address access size frequency control register frqcr r/w h'0102 h'ffffff80 16
203 9.3 clock operating modes table 9.3 shows the relationship between the mode control pin (md2Cmd0) combinations and the clock operating modes. table 9.4 shows the usable frequency ranges in the clock operating modes. table 9.3 clock operating modes pin values clock i/o pll2 pll1 divider 1 divider 2 ckio modemd2 md1 md0 source output on/off on/off input input frequency 0 0 0 0 extal ckio on, multi- plication ratio: 1 on pll1 output pll1 (extal) 1 0 0 1 extal ckio on, multi- plication ratio: 4 on pll1 output pll1 (extal) 4 2 0 1 0 crystal oscillator ckio on, multi- plication ratio: 4 on pll1 output pll1 (crystal) 4 3 0 1 1 extal ckio on, multi- plication ratio: 1 off (initial value) pll2 output pll2 (extal) 1 on pll1 output 4 1 0 0 crystal oscillator ckio on, multi- plication ratio: 1 off (initial value) pll2 output pll2 (crystal) 1 on pll1 output 7 1 1 1 ckio C off on pll1 output pll1 (ckio) mode 0: an external clock is input from the extal pin and undergoes waveform shaping by pll circuit 2 before being supplied inside this lsi. pll circuit 1 is constantly on, and there are no frequency range restrictions compared to mode 3. an input clock frequency of 20 mhz to 66.67 mhz can be used, and the ckio frequency range is 20 mhz to 66.67 mhz.
204 mode 1: an external clock is input from the extal pin and its frequency is multiplied by 4 by pll circuit 2 before being supplied inside this lsi, allowing a low-frequency external clock to be used. an input clock frequency of 5 mhz to 16.67 mhz can be used, and the ckio frequency range is 20 mhz to 66.67 mhz. mode 2: the on-chip crystal oscillator operates, with the oscillation frequency being multiplied by 4 by pll circuit 2 before being supplied inside this lsi, allowing a low crystal frequency to be used. a crystal oscillation frequency of 5 mhz to 16.67 mhz can be used, and the ckio frequency range is 20 mhz to 66.67 mhz. mode 3: an external clock is input from the extal pin and undergoes waveform shaping by pll circuit 2 before being supplied inside this lsi. pll circuit 1 is off in the default state at power-on reset, and pll circuit 1 can be selected as on or off, enabling power consumption to be kept lower than in mode 0. an input clock frequency of 16 mhz to 33.34 mhz can be used, and the ckio frequency range is 16 mhz to 33.34 mhz. mode 4: the on-chip crystal oscillator operates, with its output supplied inside this lsi as a square waveform by pll circuit 2. pll circuit 1 is off in the default state at power-on reset, and pll circuit 1 can be selected as on or off, enabling power consumption to be reduced accordingly. a crystal oscillation frequency of 16 mhz to 33.34 mhz can be used, and the ckio frequency range is 16 mhz to 33.34 mhz. mode 7: in this mode, the ckio pin is an input, an external clock is input to this pin, and undergoes waveform shaping, and also frequency multiplication according to the setting, by pll circuit 1 before being supplied to this lsi. in modes 0 to 4, the system clock is generated from the output of this lsis ckio pin. consequently, if a large number of ics are operating on the clock cycle, the ckio pin load will be large. this mode, however, assumes a comparatively large-scale system. if a large number of ics are operating on the clock cycle, a clock generator with a number of low-skew clock outputs can be provided, so that the ics can operate synchronously by distributing the clocks to each one. as pll circuit 1 compensates for fluctuations in the ckio pin load, this mode is suitable for connection of synchronous dram.
205 table 9.4 available combination of clock mode and frqcr values clock mode frqcr pll1 pll2 clock rate * (i:b:p) input frequency range ckio frequency range 0 h'0100 on ( 1) on ( 1) 1:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0101 on ( 1) on ( 1) 1:1:1/2 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0102 on ( 1) on ( 1) 1:1:1/4 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0111 on ( 2) on ( 1) 2:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0112 on ( 2) on ( 1) 2:1:1/2 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0115 on ( 2) on ( 1) 1:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0116 on ( 2) on ( 1) 1:1:1/2 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0122 on ( 4) on ( 1) 4:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0126 on ( 4) on ( 1) 2:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'012a on ( 4) on ( 1) 1:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'a100 on ( 3) on ( 1) 3:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'a101 on ( 3) on ( 1) 3:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz h'e100 on ( 3) on ( 1) 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'e101 on ( 3) on ( 1) 1:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz h'a111 on ( 6) on ( 1) 6:1:1 20 mhz to 22.22 mhz 20 mhz to 22.22 mhz 1, 2 h'0100 on ( 1) on ( 4) 4:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'0101 on ( 1) on ( 4) 4:4:2 5 mhz to 16.6 mhz 20 mhz to 16.6 mhz h'0102 on ( 1) on ( 4) 4:4:1 5 mhz to 16.6 mhz 20 mhz to 16.6 mhz h'0111 on ( 2) on ( 4) 8:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'0112 on ( 2) on ( 4) 8:4:2 5 mhz to 16.67 mhz 20 mhz to 66.67 mhz h'0115 on ( 2) on ( 4) 4:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'0116 on ( 2) on ( 4) 4:4:2 5 mhz to 16.67 mhz 20 mhz to 66.67 mhz h'0122 on ( 4) on ( 4) 16:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'0126 on ( 4) on ( 4) 8:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'012a on ( 4) on ( 4) 4:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'a100 on ( 3) on ( 4) 12:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'a101 on ( 3) on ( 4) 12:4:2 5 mhz to 11.11 mhz 20 mhz to 44.44 mhz h'e100 on ( 3) on ( 4) 4:4:4 5 mhz to 8.34 mhz 20 mhz to 33.34 mhz h'e101 on ( 3) on ( 4) 4:4:2 5 mhz to 11.11 mhz 20 mhz to 44.44 mhz
206 table 9.4 available combination of clock mode and frqcr values (cont) clock mode frqcr pll1 pll2 clock rate * (i:b:p) input frequency range ckio frequency range 3, 4 h'0100 off on ( 1) 1:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'0101 off on ( 1) 1:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'0102 off on ( 1) 1:1:1/4 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01d0 on ( 2) on ( 1) 2:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01d1 on ( 2) on ( 1) 2:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01d2 on ( 2) on ( 1) 2:1:1/4 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01d4 on ( 2) on ( 1) 1:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01d5 on ( 2) on ( 1) 1:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01d6 on ( 2) on ( 1) 1:1:1/4 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'81c0 on ( 3) on ( 1) 3:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'81c1 on ( 3) on ( 1) 3:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'c1c0 on ( 3) on ( 1) 1:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'c1c1 on ( 3) on ( 1) 1:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e0 on ( 4) on ( 1) 4:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e1 on ( 4) on ( 1) 4:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e4 on ( 4) on ( 1) 2:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e5 on ( 4) on ( 1) 2:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e6 on ( 4) on ( 1) 2:1:1/4 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e8 on ( 4) on ( 1) 1:1:1 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01e9 on ( 4) on ( 1) 1:1:1/2 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01ea on ( 4) on ( 1) 1:1:1/4 16 mhz to 33.34 mhz 16 mhz to 33.34 mhz h'01f0 on ( 8) on ( 1) 8:1:1 16 mhz to 16.67 mhz 16 mhz to 16.67 mhz h'81d0 on ( 6) on ( 1) 6:1:1 16 mhz to 22.22 mhz 16 mhz to 22.22 mhz 7 h'0100 on ( 1) off 1:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0101 on ( 1) off 1:1:1/2 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0102 on ( 1) off 1:1:1/4 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0111 on ( 2) off 2:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0112 on ( 2) off 2:1:1/2 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0115 on ( 2) off 1:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0116 on ( 2) off 1:1:1/2 20 mhz to 66.67 mhz 20 mhz to 66.67 mhz h'0122 on ( 4) off 4:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'0126 on ( 4) off 2:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz h'012a on ( 4) off 1:1:1 20 mhz to 33.34 mhz 20 mhz to 33.34 mhz
207 table 9.4 available combination of clock mode and frqcr values (cont) clock mode frqcr pll1 pll2 clock rate * (i:b:p) input frequency range ckio frequency range 7 h'a100 on ( 3) off 3:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'e100 on ( 3) off 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'e101 on ( 3) off 1:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz h'a111 on ( 6) off 6:1:1 20 mhz to 22.22 mhz 20 mhz to 22.22 mhz max. frequency: i = 133.34 mhz, b (ckio) = 66.67 mhz, p = 33.34 mhz note: * taking input clock as 1 cautions: 1. when clock operating modes 3, 4 are used: ? the on/off state of pll circuit 1 is set by the frequency control register. ? pll circuit 1 is initialized to the off state by a power-on reset. ? always turn pll circuit 1 off before going into standby mode. 2. the input to divider 1 becomes the output of: ? pll circuit 1 when pll circuit 1 is on. ? pll circuit 2 when pll circuit 1 is off and pll circuit 2 is on. 3. the input of divider 2 becomes the output of: ? pll circuit 1 when the clock operating mode is 0C2 or 7. ? pll circuit 2 when the clock operating mode is 3, 4 and pll circuit 2 is on. 4. the frequency of the internal clock (i ) becomes: ? the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 1 when pll circuit 1 is on. ? equal to the frequency of ckio pin when pll circuit 1 is off. ? do not set the internal clock frequency lower than the ckio pin frequency. 5. the frequency of the peripheral clock (p ) becomes: ? the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 2 when the clock operating mode is 0C2 or 7. ? the product of the frequency of the ckio pin and the division ratio of divider 2 when the clock operating mode is 3, 4. ? the peripheral clock frequency should not be set higher than the frequency of the ckio pin, higher than 33 mhz, or lower than 1/8 the internal clock (i ). 6. the output frequency of pll circuit 1 is the product of the ckio frequency and the multiplication ratio of pll circuit 1. this frequency should be equal to or lower than 133 mhz.
208 7. 1, 2, 3, 4, 6, or 8 can be used as the multiplication ratio of pll circuit 1. 1, 1/2, 1/ 3, 1/4, and 1/6 can be selected as the division ratios of dividers 1 and 2. set the rate in the frequency control register. the on/off state of pll circuit 2 is determined by the mode. 9.4 register descriptions 9.4.1 frequency control register (frqcr) the frequency control register (frqcr) is a 16-bit read/write register used to specify whether a clock is output from the ckio pin, the on/off state of pll circuit 1, pll standby, the frequency multiplication ratio of pll circuit 1, and the frequency division ratio of the internal clock and the peripheral clock. only word access can be used on the frqcr register. frqcr is initialized to h'0102 by a power-on reset, but retains its value in a manual reset and in standby mode. bit: 15 14 13 12 11 10 9 8 stc2 ifc2 pfc2 slpfrq ckoen initial value: 0 0 0 0 0 0 0 1 r/w: r/w r/w r/w r r r r/w r/w bit: 7 6 5 4 3 2 1 0 pllen pstby stc1 stc0 ifc1 ifc0 pfc1 pfc0 initial value: 0 0 0 0 0 0 1 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15, 5, and 4frequency multiplication ratio (stc2 to stc0): these bits specify the frequency multiplication ratio of pll circuit 1. bit 15: stc2 bit 5: stc1 bit 4: stc0 description 000 1 (initial value) 001 2 100 3 010 4 101 6 011 8 note: do not set the output frequency of pll circuit 1 higher than 133 mhz.
209 bits 14, 3, and 2internal clock frequency division ratio (ifc2 to ifc0): these bits specify the frequency division ratio of the internal clock with respect to the output frequency of pll circuit 1. when pll circuit 1 is off or in standby mode, set 1. bit 14: ifc2 bit 3: ifc1 bit 2: ifc0 description 000 1 (initial value) 001 1/2 100 1/3 010 1/4 note: do not set the internal clock frequency lower than the ckio frequency. bits 13, 1, and 0peripheral clock frequency division ratio (pfc2 to pfc0): these bits specify the division ratio of the peripheral clock frequency with respect to the frequency of the output frequency of pll circuit 1 or the frequency of the ckio pin. bit 13: pfc2 bit 1: pfc1 bit 0: pfc0 description 000 1 001 1/2 100 1/3 010 1/4 101 1/6 (initial value) note: do not set the peripheral clock frequency higher than the frequency of the ckio pin. bits 12 to 10reserved: these bits are always read as 0. the write value should always be 0. bit 9divide ratio of the external bus clock in the sleep mode (slpfrq): slpfrq specifies the divide ratio of the external bus clock in the sleep mode in clock modes 3 to 7. the clock frequency output from the ckio is not changed. since the memory refresh cycle is fixed by the bus state controller, the rtscr register or other setting needs not to be changed. bit 9: slpfrq description 0 external bus clock is not changed in the sleep mode. (initial value) 1 external bus clock is multiplied by 1/4 in the sleep mode.
210 bit 8clock output enable (ckoen): specifies to output a clock from the ckio pin or to fix the ckio pin low in clock operating mode 3 and 4. even when the level is fixed, the sh7709a will operate internally at the frequency before the level was fixed. set this bit to 1 in clock operating modes 0C2. in case of clock operating mode 7, the ckio pin becomes an input pin irrespective of the value of this bit. bit 8: ckoen description 0 fixes the ckio pin low. 1 outputs a clock from the ckio pin. (initial value) bit 7pll circuit enable (pllen): specifies the on/off state of pll circuit 1. this bit is valid in clock operating modes 3 and 4. pll circuit 1 goes on when the clock operating mode is 0C2 or 7 irrespective of the value of pllen. bit 7: pllen description 0 pll circuit 1 is not used. (initial value) 1 pll circuit 1 is used. bit 6pll standby (pstby): specifies pll standby. when pll standby is active, pll circuit 1 will be in standby mode at the frequency specified by the stc bit. this function is valid in clock operating modes 3 and 4. bit 6: pstby description 0 pll is not in standby mode. (initial value) 1 pll is in standby mode.
211 9.5 changing the frequency the frequency of the internal clock and peripheral clock can be changed either by changing the multiplication rate of pll circuit 1 or by changing the division rates of dividers 1 and 2. all of these are controlled by software through the frequency control register. the methods are described below. in modes 3, 4 the frequency can also be changed by turning pll circuit 1 on and off, as described in section 9.6, pll standby function. 9.5.1 changing the multiplication rate a pll settling time is required when the multiplication rate of pll circuit 1 is changed. the on- chip wdt counts the settling time. 1. in the initial state, the multiplication rate of pll circuit 1 is 1. 2. set a value that will become the specified oscillation settling time in the wdt and stop the wdt. the following must be set: wtcsr register tme bit = 0: wdt stops wtcsr register cks2Ccks0 bits: division ratio of wdt count clock wtcnt counter: initial counter value 3. set the desired value in the stc2, stc1 and stc0 bits. the division ratio can also be set in the ifc2Cifc0 bits and pfc2Cpfc0 bits. 4. the processor pauses internally and the wdt starts incrementing. in clock modes 0C2 and 7, the internal and peripheral clocks both stop, but the peripheral clock for wdt will not stop. in clock modes 3 and 4, only the internal clock stops. the clock will continue to be output at the ckio pin as long as the ckoen bit in the frqcr register is set to 1. 5. supply of the clock that has been set begins at wdt count overflow, and the processor begins operating again. the wdt stops after it overflows. 9.5.2 note on changing the multiplication rate erroneous operation will occur under the following conditions. ? conditions if a cache related read fill cycle or write-back cycle is generated within four peripheral clock cycles (16 i system clock cycles in the case of a clock ratio of i:b:p = 1:1:1/4) after the cpgs frequency control register (frqcr) is modified. ? problem the data may be incorrect in a read fill or write-back cycle, and may result in cpu runaway. when modifying the cpgs frequency control register (frqcr), ensure that a cache fill or write- back does not occur for at least four peripheral clock (p ) cycles after the modification. this can be achieved by either of the following methods, for example.
212 1. place an instruction that accesses a peripheral module (rtc, tmu, sci, dmac, cmt, scif, irda, a/d, d/a, or port) register immediately after the multiplication rate change instruction. 2. place 20 nop instructions immediately after the multiplication rate change instruction (in a non-cache area). 9.5.3 changing the division ratio the wdt will not count unless the multiplication rate is changed simultaneously. 1. in the initial state, ifc2Cifc0 = 000 and pfc2Cpfc0 = 010. 2. set the ifc2, ifc1, ifc0, pfc2, pfc1, and pfc0 bits to the new division ratio. the values that can be set are limited by the clock mode and the multiplication rate of pll circuit 1. note that if the wrong value is set, the processor will malfunction. 3. the clock is immediately supplied at the new division ratio. 9.6 pll standby function 9.6.1 overview of the pll standby function when operating in clock modes 3 and 4, the internal clock can be controlled by turning the pll1 circuit on and off. a long oscillation settling time is required, however, when the pll circuit is started up from a complete halt. during this time, processor operation halts. to enable fast on/off switching of the pll1 circuit, the pll standby function is provided. this function is controlled by software using the frequency control register. the use of the pll standby function is described below. 9.6.2 usage from off to on : 1. initially, pstby = 0, pllen = 0, and pll circuit 1 is stopped. the output of pll circuit 2 is used for divider 1 input. 2. when the multiplication rate of pll circuit 1 is set in the stc2Cstc0 bits and pstby is set to 1, pll circuit 1 begins oscillating at the specified multiplication rate. the input to divider 1 is still the output of pll circuit 2 at this point. 3. after pll circuit 1 oscillation has stabilized, the input of divider 1 switches when pllen is set to 1 and the oscillation output of pll circuit 1 is divided and becomes the internal clock. at this time, the division ratio can be changed by changing the settings of ifc2Cifc0 and pfc2Cpfc0. for several cycles before and after the clock switches, the internal clock will be stopped, but the peripheral clock and ckio output do not stop.
213 from on to off : 1. when pllen is set to 0, the input of divider 1 switches to the output of pll circuit 2. at this time, the division ratio can be changed by changing the settings of ifc2Cifc0 and pfc2C pfc0. 2. when pstby is set to 0, pll circuit 1 stops. this setting can be performed simultaneously (and with the same instruction as) the setting in 1 above. notes: 1. there are some restrictions on the pll standby state (pstby = 1, pllen = 0) as follows: the settings of the frequency control registers ckoen, stc2Cstc0, ifc2Cifc0 and pfc2Cpfc0 bits generally cannot be changed. in some cases, however, they can be changed if the pstby and pllen bit settings are also changed simultaneously (figure 9.2). the sleep instruction cannot be executed. 2. it is the responsibility of software to ensure the oscillation settling time. if pllen is set to 1 before the oscillation has settled, malfunctions may be caused by an unstable clock. 3. in clock modes 3 and 4, this lsi cannot go to standby mode while pll circuit 1 is on. always set pstby and pllen to 0 to stop pll circuit 1 before going to standby mode. 4. when pstby and pllen are both changed from 0 to 1 together, the wdt will automatically start counting and the clock will switch when the wdt overflows. see section 9.5, changing the frequency, for setting the wdt. pll1 off pll1 standby pstby = 1 (stc) pstby = 0 (stc) pll1 on pllen = 1 (ifc, pfc) pstby = 1 and pllen = 1 pstby = 0, pllen = 0 (stc, ifc, pfc) pstby = 0 and pllen = 0 pstby = 1 and pllen = 0 pllen = 0 (stc, ifc, pfc) note: bits in parentheses can be changed simultaneously. figure 9.2 state transitions for the pll standby function
214 9.7 controlling clock output the ckoen bit in the frqcr register can be used to switch between outputting a clock to the ckio pin or having the level fixed. 9.7.1 clock modes 0 to 2 the ckio pin level cannot be fixed. always set the ckoen bit in frqcr to 1 (clock output). 9.7.2 clock modes 3, 4 the ckio output changes as soon as the ckoen bit is changed. when the wdt is started by simultaneously changing the multiplication rate of pll circuit 1 or switching pll circuit 1 on or off, the wdt starts running after the ckio output is switched, and then the internal clock changes.
215 9.8 overview of the wdt 9.8.1 block diagram of the wdt figure 9.3 shows a block diagram of the wdt. wtcsr standby control bus interface wtcnt divider clock selector clock internal bus standby mode peripheral clock standby cancellation reset control clock selection wdt overflow internal reset request interrupt control interrupt request wtcsr: wtcnt: watchdog timer control/status register watchdog timer counter legend: figure 9.3 block diagram of the wdt 9.8.2 register configurations the wdt has two registers that select the clock, switch the timer mode, and perform other functions. table 9.5 shows the wdt register. table 9.5 register configuration name abbreviation r/w initial value address access size watchdog timer counter wtcnt r/w * h'00 h'ffffff84 r: byte; w: word * watchdog timer control/status register wtcsr r/w * h'00 h'ffffff86 r: byte; w: word * note: * write with a word access. write h'5a and h'a5, respectively, in the upper bytes. byte or longword writes are not possible. read with a byte access.
216 9.9 wdt registers 9.9.1 watchdog timer counter (wtcnt) the watchdog timer counter (wtcnt) is an 8-bit read/write counter that increments on the selected clock. when an overflow occurs, it generates a reset in watchdog timer mode and an interrupt in interval time mode. its address is h'ffffff84. the wtcnt counter is initialized to h'00 only by a power-on reset through the resetp pin. use a word access to write to the wtcnt counter, with h'5a in the upper byte. use a byte access to read wtcnt. note: the method of writing to this register differs from that for general registers to prevent inadvertent rewriting. for details, see section 9.9.3, notes on register access. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 9.9.2 watchdog timer control/status register (wtcsr) the watchdog timer control/status register (wtcsr) is an 8-bit read/write register composed of bits to select the clock used for the count, bits to select the timer mode, and overflow flags. its address is h'ffffff86. the wtcsr register is initialized to h'00 only by a power-on reset through the resetp pin. when a wdt overflow causes an internal reset, the wtcsr retains its value. when used to count the clock settling time for canceling a standby, it retains its value after counter overflow. use a word access to write to the wtcsr counter, with h'a5 in the upper byte. use a byte access to read wtcsr. note: the method of writing to this register differs from that for general registers to prevent inadvertent rewriting. for details, see section 9.9.3, notes on register access. bit: 7 6 5 4 3 2 1 0 tme wt/ it rsts wovf iovf cks2 cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7timer enable (tme): starts and stops timer operation. clear this bit to 0 when using the wdt in standby mode or when changing the clock frequency.
217 bit 7: tme description 0 timer disabled: count-up stops and wtcnt value is retained (initial value) 1 timer enabled bit 6timer mode select (wt/ it ): selects whether to use the wdt as a watchdog timer or an interval timer. bit 6: wt/ it description 0 use as interval timer (initial value) 1 use as watchdog timer note: if wt/ it is modified when the wdt is running, the up-count may not be performed correctly. bit 5reset select (rsts): selects the type of reset when the wtcnt overflows in watchdog timer mode. in interval timer mode, this setting is ignored. bit 5: rsts description 0 power-on reset (initial value) 1 manual reset note: resetout is output. bit 4watchdog timer overflow (wovf): indicates that the wtcnt has overflowed in watchdog timer mode. this bit is not set in interval timer mode. bit 4: wovf description 0 no overflow (initial value) 1 wtcnt has overflowed in watchdog timer mode bit 3interval timer overflow (iovf): indicates that the wtcnt has overflowed in interval timer mode. this bit is not set in watchdog timer mode. bit 3: iovf description 0 no overflow (initial value) 1 wtcnt has overflowed in interval timer mode bits 2 to 0clock select 2 to 0 (cks2 to cks0): these bits select the clock to be used for the wtcnt count from the eight types obtainable by dividing the peripheral clock. the overflow period in the table is the value when the peripheral clock (p ) is 15 mhz.
218 bit 2: cks2 bit 1: cks1 bit 0: cks0 clock division ratio overflow period (when p = 15 mhz) 0001 (initial value) 17 s 1 1/4 68 s 1 0 1/16 273 s 1 1/32 546 s 1 0 0 1/64 1.09 ms 1 1/256 4.36 ms 1 0 1/1024 17.48 ms 1 1/4096 69.91 ms note: if bits cks2Ccks0 are modified when the wdt is running, the up-count may not be performed correctly. ensure that these bits are modified only when the wdt is not running. 9.9.3 notes on register access the watchdog timer counter (wtcnt) and watchdog timer control/status register (wtcsr) are more difficult to write to than other registers. the procedure for writing to these registers are given below. writing to wtcnt and wtcsr: these registers must be written by a word transfer instruction. they cannot be written by a byte or longword transfer instruction. when writing to wtcnt, set the upper byte to h'5a and transfer the lower byte as the write data, as shown in figure 9.4. when writing to wtcsr, set the upper byte to h'a5 and transfer the lower byte as the write data. this transfer procedure writes the lower byte data to wtcnt or wtcsr. 15 8 7 0 h'5a write data address: h'fffffe84 wtcnt write 15 8 7 0 h'a5 write data address: h'fffffe86 wtcsr write figure 9.4 writing to wtcnt and wtcsr
219 9.10 using the wdt 9.10.1 canceling standbys the wdt can be used to cancel standby mode with an nmi or other interrupts. the procedure is described below. (the wdt does not run when resets are used for canceling, so keep the resetp pin or resetm pin low until the clock stabilizes.) 1. before transitioning to standby mode, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2Ccks0 bits in wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. move to standby mode by executing a sleep instruction to stop the clock. 4. the wdt starts counting by detecting the edge change of the nmi signal or detecting interrupts. 5. when the wdt count overflows, the cpg starts supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 6. since the wdt continues counting from h00, set the stby bit in the stbcr register to 0 in the interrupt processing program and this will stop the wdt. when the stby bit remains 1, the sh7709a again enters the standby mode when the wdt has counted up to h80. this standby mode can be canceled by power-on resets. 9.10.2 changing the frequency to change the frequency used by the pll, use the wdt. when changing the frequency only by switching the divider, do not use the wdt. 1. before changing the frequency, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2Ccks0 bits of wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. when the frequency control register (frqcr) is written, internal processor operation stops temporarily and the wdt starts counting. 4. when the wdt count overflows, the cpg resumes supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 5. the counter stops at the values h'00Ch'01. the stop value depends on the clock ratio. 6. when writing to wtcnt after the frequency is changed, read wtcnt and confirm that its value is h'00 before performing the write.
220 9.10.3 using watchdog timer mode 1. set the wt/ it bit in the wtcsr register to 1, set the reset type in the rsts bit, set the type of count clock in the cks2Ccks0 bits, and set the initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in watchdog timer mode. 3. while operating in watchdog timer mode, rewrite the counter periodically to h'00 to prevent the counter from overflowing. 4. when the counter overflows, the wdt sets the wovf flag in wtcsr to 1 and generates the type of reset specified by the rsts bit. the counter then resumes counting. when a reset occurs, a low level is output from the resetout pin, and a high level is output from the status0 and status1 pins. the signal output period is about one cycle of the count clock for power-on reset, and about five cycles of the peripheral clock for manual reset. 9.10.4 using interval timer mode when operating in interval timer mode, interval timer interrupts are generated at every overflow of the counter. this enables interrupts to be generated at set periods. 1. clear the wt/ it bit in the wtcsr register to 0, set the type of count clock in the cks2C cks0 bits, and set the initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in interval timer mode. 3. when the counter overflows, the wdt sets the iovf flag in wtcsr to 1 and an interval timer interrupt request is sent to intc. the counter then resumes counting.
221 9.11 notes on board design when using an external crystal oscillator: place the crystal oscillator, capacitors cl1 and cl2, and damping resistor r close to the extal and xtal pins. to prevent induction from interfering with correct oscillation, use a common grounding point for the capacitors connected to the oscillator, and do not locate a wiring pattern near these components. note: the values for cl1, cl2, and the damping resistance should be determined after consultation with the crystal oscillator manufacturer. xtal extal sh7709a r cl2 cl1 avoid crossing signal lines figure 9.5 points for attention when using crystal oscillator decoupling capacitors: as far as possible, insert a laminated ceramic capacitor of 0.01 to 0.1 f as a passive capacitor for each v ss /v cc pair. mount the passive capacitors as close as possible to the sh7709a power supply pins, and use components with a frequency characteristic suitable for the chips operating frequency, as well as a suitable capacitance value. digital system v ss /v cc pairs: 19-21, 27-29, 33-35, 45-47, 57-59, 69-71, 79-81, 83-85, 95-97, 109- 111, 132-134, 153-154, 161-163, 173-175, 181-183, 205-208 on-chip oscillator v ss /v cc pairs: 3-6, 145-147, 148-150 when using a pll oscillator circuit: keep the wiring from the pll v cc and v ss connection pattern to the power supply pins short, and make the pattern width large, to minimize the inductance component. ground the oscillation stabilization capacitors c1 and c2 to v ss (pll1) and v ss (pll2), respectively. place c1 and c2 close to the cap1 and cap2 pins and do not locate a wiring pattern in the vicinity. in clock mode 7, connect the extal pin to v cc or v ss and leave the xtal pin open.
222 cap2 v cc (pll2) v cc (pll1) v cc c1 = 470 pf c2 = 470 pf v ss cap1 v ss (pll2) v ss (pll1) avoid crossing signal lines power supply reference values c2 c1 figure 9.6 points for attention when using pll oscillator circuit
223 section 10 bus state controller (bsc) 10.1 overview the bus state controller (bsc) divides physical address space and output control signals for various types of memory and bus interface specifications. bsc functions enable this lsi to link directly with dram, synchronous dram, sram, rom, and other memory storage devices without an external circuit. the bsc also allows direct connection to pcmcia interfaces, simplifying system design and allowing high-speed data transfers in a compact system. 10.1.1 features the bsc has the following features: ? physical address space is divided into six areas ? a maximum 64 mbytes for each of the six areas, 0, 2C6 ? area bus width can be selected by register (area 0 is set by external pin) ? wait states can be inserted using the wait pin ? wait state insertion can be controlled through software. register settings can be used to specify the insertion of 1C10 cycles independently for each area (1C38 cycles for areas 5 and 6 and the pcmciat interface only) ? the type of memory connected can be specified for each area, and control signals are output for direct memory connection ? wait cycles are automatically inserted to avoid data bus conflict for continuous memory accesses to different areas or writes directly following reads of the same area ? direct interface to dram ? multiplexes row/column addresses according to dram capacity ? supports burst operation (high-speed page mode, edo mode, and short-pitch access) ? supports cas-before-ras refresh and self-refresh ? controls timing of dram direct-connection control signals according to register settings ? direct interface to synchronous dram ? multiplexes row/column addresses according to synchronous dram capacity ? supports burst operation ? supports bank active mode ? has both auto-refresh and self-refresh functions ? controls timing of synchronous dram direct-connection control signals according to register setting
224 ? burst rom interface ? insertion of wait states controllable through software ? register setting control of burst transfers ? pcmcia direct-connection interface ? insertion of wait states controllable through software ? bus sizing function for i/o bus width (only in the little endian mode) ? refresh function ? refresh cycles will be automatically maintained in the sleep mode even after the external bus frequency is reduced to 1/4 of its normal operating frequency ? short refresh cycle control ? the overflow interrupt function of the refresh counter enables the refresh function immediately after the self-refresh operation using the low power-consumption dram ? the refresh counter can be used as an interval timer ? outputs an interrupt request signal using the compare-matching function ? outputs an interrupt request signal when the refresh counter overflows ? automatically disables the output of clock signals to anywhere but the refresh counter, except during execution of external bus cycles
225 10.1.2 block diagram figure 10.1 shows the functional block diagram of the bus state controller. wcr1 wcr2 bcr1 module bus bcr3 mcr dcr bsc rfcr rtcnt comparator refresh controller peripheral bus internal bus interrupt controller memory controller area controller wait controller wait cs0, cs6Ccs2, ce2a, ce2b mcs0Cmcs7 bs rd rd/wr we3Cwe0 ras, rasxx cas, casxx cke iciord, iciowr iois16 wcr: bcr: mcr: dcr: pcr: legend bus interface rtcsr rtcor bcr2 pcr mcscrn wait state control register bus control register memory control register dram control register pcmcia control register rfcr: rtcnt: rtcor: rtcsr: mcscrn: refresh count register refresh timer count register refresh time constant register refresh timer control/status register mcsn control register (n:0-7) figure 10.1 bsc functional block diagram
226 10.1.3 pin configuration table 10.1 lists the bsc pin configuration. table 10.1 pin configuration pin name signal i/o description address bus a25Ca0 o address output data bus d15Cd0 i/o data i/o d31Cd16 i/o when 32-bit bus width, data i/o bus cycle start bs o shows start of bus cycle. during burst transfers, asserts every data cycle. chip select 0, 2C4 cs0 , cs2 C cs4 o chip select signal to indicate area being accessed. chip select 5, 6 cs5 / ce1a , cs6 / ce1b o chip select signal to indicate area being accessed. cs5 / ce1a and cs6 / ce1b can also be used as ce1a and ce1b of pcmcia. pcmcia card select ce2a , ce2b o when pcmcia is used, ce2a and ce2b read/write rd/ wr o data bus direction indicator signal. dram/pcmcia write indicator signal. row address strobe 3l ras3l o when dram or synchronous dram is used in area 3, ras3l for lower 32-mbyte address. row address strobe 3u ras3u o when dram or synchronous dram is used in area 3, ras3u for upper 32-mbyte address. column address strobe casll / casl o when dram is used, casll signal for d7Cd0. when synchronous dram is used, casl signal for lower 32-mbyte address. column address strobe lh caslh / casu o when dram is used, caslh signal for d15Cd8. when synchronous dram is used, casu signal for upper 32-mbyte address. column address strobe hl cashl o when dram is used, cashl signal for d23Cd16. column address strobe hh cashh o when dram is used, cashh signal for d31Cd24. column address strobe 2l cas2l o when the area 2 dram is used, cas2l signal for d7Cd0. column address strobe 2h cas2h o when the area 2 dram is used, cas2h signal for d15Cd8.
227 table 10.1 pin configuration (cont) pin name signal i/o description data enable 0 we0 /dqmll o when memory other than synchronous dram is used, selects d7Cd0 write strobe signal. when synchronous dram is used, selects d7Cd0. data enable 1 we1 /dqmlu/ we o when memory other than synchronous dram is used, selects d15Cd8 write strobe signal. when synchronous dram is used, selects d15Cd8. when pcmcia is used, strobe signal that indicates the write cycle. data enable 2 we2 /dqmul/ iciord o when memory other than synchronous dram is used, selects d23Cd16 write strobe signal. when synchronous dram is used, selects d23Cd16. when pcmcia is used, strobe signal indicating i/o read. data enable 3 we3 /dqmuu/ iciowr o when memory other than synchronous dram is used, selects d31Cd24 write strobe signal. when synchronous dram is used, selects d31Cd24. when pcmcia is used, strobe signal indicating i/o write. read rd o strobe signal indicating read cycle wait wait i wait state request signal clock enable cke o clock enable control signal of synchronous dram iois16 iois16 i signal indicating pcmcia 16-bit i/o. valid only in little-endian mode. bus release request breq i bus release request signal bus release acknowledgment back o bus release acknowledge signal row address strobe 2l ras2l o when dram is used in area 2, ras2l signal for lower 32-mbyte address row address strobe 2u ras2u o when dram is used in area 2, ras2u signal for upper 32-mbyte address mask rom chip select mcs[0] C mcs[7] o chip select signal for mask rom connected to area 0 or 2.
228 10.1.4 register configuration the bsc has 21 registers (table 10.2). the synchronous dram also has a built-in synchronous dram mode register. these registers control direct connection interfaces to memory, wait states, refreshes, and pcmcia devices. table 10.2 register configuration name abbr. r/w initial value * address bus width bus control register 1 bcr1 r/w h'0000 h'ffffff60 16 bus control register 2 bcr2 r/w h'3ff0 h'ffffff62 16 wait state control register 1 wcr1 r/w h'3ff3 h'ffffff64 16 wait state control register 2 wcr2 r/w h'ffff h'ffffff66 16 individual memory control register mcr r/w h'0000 h'ffffff68 16 dram control register dcr r/w h'0000 h'ffffff6a 16 pcmcia control register pcr r/w h'0000 h'ffffff6c 16 refresh timer control/status register rtcsr r/w h'0000 h'ffffff6e 16 refresh timer counter rtcnt r/w h'0000 h'ffffff70 16 refresh time constant register rtcor r/w h'0000 h'ffffff72 16 refresh count register rfcr r/w h'0000 h'ffffff74 16 bus control register 3 bcr3 r/w h'0000 h'ffffff7e 16 synchronous dram mode register, area 2 sdmr w h'ffffd000C h'ffffdfff 8 synchronous dram mode register, area 3 h'ffffe000C h'ffffefff mcs0 control register mcscr0 r/w h'0000 h'ffffff50 16 mcs1 control register mcscr1 r/w h'0000 h'ffffff52 16 mcs2 control register mcscr2 r/w h'0000 h'ffffff54 16 mcs3 control register mcscr3 r/w h'0000 h'ffffff56 16 mcs4 control register mcscr4 r/w h'0000 h'ffffff58 16 mcs5 control register mcscr5 r/w h'0000 h'ffffff5a 16 mcs6 control register mcscr6 r/w h'0000 h'ffffff5c 16 mcs7 control register mcscr7 r/w h'0000 h'ffffff5e 16 notes: for details, see section 10.2.9, synchronous dram mode register (sdmr). * initialized by power-on resets.
229 10.1.5 area overview space allocation: in the architecture of this lsi, both logical spaces and physical spaces have 32- bit address spaces. the logical space is divided into five areas by the value of the upper bits of the address. the physical space is divided into eight areas. logical space can be allocated at physical spaces using a memory management unit (mmu). for details, refer to section 3, memory management unit (mmu), which describes area allocation for physical spaces. as listed in table 10.3, this lsi can be connected directly to six areas of memory/pcmcia interface, and it outputs chip select signals ( cs0 , cs2 C cs6 , ce2a , ce2b ) for each of them. cs0 is asserted during area 0 access; cs6 is asserted during area 6 access. when dram is connected to area 2 or 3, signals such as ras , cas , and rd/ wr are also asserted. when pcmcia interface is selected in area 5 or 6, in addition to cs5 / cs6 , ce2a / ce2b are asserted for the corresponding bytes accessed. area 0 (cs0) internal i/o area 2 (cs2) area 3 (cs3) area 4 (cs4) area 5 (cs5) area 6 (cs6) h'00000000 h'20000000 h'40000000 h'60000000 h'80000000 h'a0000000 h'c0000000 h'e0000000 h'00000000 h'04000000 h'08000000 h'0c000000 h'10000000 h'14000000 h'18000000 reserved area physical address space logical address space p0, u0 p1 p2 p3 p4 note: for logical address spaces p0 and p3, when the memory management unit (mmu) is on, it can optionally generate a physical address for the logical address. it can be applied when the mmu is off and when the mmu is on and each physical address for the logical address is equal except for upper three bits. figure 10.2 corresponding to logical address space and physical address space
230 table 10.3 physical address space map area connectable memory physical address capacity access size 0 ordinary memory * 1 , burst rom h'00000000 to h'03ffffff 64 mbytes 8, 16, 32 * 2 h'00000000 + h'20000000 n to h'03ffffff + h'20000000 n shadow n: 1C6 1 internal i/o registers * 8 h'04000000 to h'07ffffff 64 mbytes 8, 16, 32 * 3 h'04000000 + h'20000000 n to h'07ffffff + h'20000000 n shadow n: 1C6 2 ordinary memory * 1 , h'08000000 to h'0bffffff 64 mbytes 8, 16, 32 * 3, * 4 synchronous dram, dram h'08000000 + h'20000000 n to h'0bffffff + h'20000000 n shadow n: 1C6 3 ordinary memory, h'0c000000 to h'0fffffff 64 mbytes 8, 16, 32 * 3, * 5 synchronous dram, dram (edo mode) h'0c000000 + h'20000000 n to h'0fffffff + h'20000000 n shadow n: 1C6 4 ordinary memory h'10000000 to h'13ffffff 64 mbytes 8, 16, 32 * 3 h'10000000 + h'20000000 n to h'13ffffff + h'20000000 n shadow n: 1C6 5 ordinary memory, pcmcia, burst rom h'14000000 to h'15ffffff 32 mbytes 8, 16, 32 * 3, * 6 ordinary memory, burst rom h'16000000 to h'17ffffff 32 mbytes h'14000000 + h'20000000 n to h'17ffffff + h'20000000 n shadow n: 1C6 6 ordinary memory, pcmcia, h'18000000 to h'19ffffff 32 mbytes 8, 16, 32 * 3, * 6 burst rom h'1a000000 to h'1bffffff h'18000000 + h'20000000 n to h'1bffffff + h'20000000 n shadow n: 1C6 7 * 7 reserved area h'1c000000 + h'20000000 n to h'1fffffff + h'20000000 n n: 0C7 notes: * 1 memory with interface such as sram or rom. * 2 use external pin to specify memory bus width. * 3 use register to specify memory bus width. * 4 with synchronous dram interfaces, bus width must be 16 or 32 bits. with dram interfaces, bus width must be 16 bits. * 5 with synchronous dram interfaces, bus width must be 16 or 32 bits. with dram interfaces, bus width must be 16 or 32 bits. * 6 with pcmcia interface, bus width must be 8 or 16 bits. * 7 do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. * 8 when the control register in area 1 is not used for address translation by the mmu, set the top three bits of the logical address to 101 to allocate in the p2 space.
231 area 0: h'00000000 area 1: h'04000000 area 2: h'08000000 area 3: h'0c000000 area 4: h'10000000 area 5: h'14000000 the pcmcia interface is shared by the memory and i/o card only dram with a 16-bit bus can be connected to area 2 the pcmcia interface is shared by the memory and i/o card area 6: h'18000000 ordinary memory/ burst rom internal i/o ordinary memory/ synchronous dram, dram ordinary memory/ synchronous dram, dram ordinary memory ordinary memory/ burst rom/pcmcia ordinary memory/ burst rom/pcmcia figure 10.3 physical space allocation memory bus width: the memory bus width in this lsi can be set for each area. in area 0, an external pin can be used to select byte (8 bits), word (16 bits), or longword (32 bits) on power-on reset. the correspondence between the external pins (md4 and md3) and memory size is listed in table below. table 10.4 correspondence between external pins (md4 and md3) and memory size md4 md3 memory size 0 0 reserved (do not set) 0 1 8 bits 1 0 16 bits 1 1 32 bits for areas 2C6, byte, word, and longword may be chosen for the bus width using bus control register 2 (bcr2) whenever ordinary memory, rom, or burst rom are used. when the dram or synchronous dram interface is used, word or longword can be chosen as the bus width. when area 2 is used as a dram area, set the bus width of area 2 to word. when the pcmcia interface is used, set the bus width to byte or word. when synchronous dram is connected to both area 2 and area 3, set the same bus width for areas 2 and 3. when using port a or b, set a bus width of 8 or 16 bits for all areas. for more information, see section 10.2.2, bus control register 2 (bcr2).
232 shadow space: areas 0, 2C6 are decoded by physical addresses a28Ca26, which correspond to areas 000 to 110. address bits 31C29 are ignored. this means that the range of area 0 addresses, for example, is h'00000000 to h'03ffffff, and its corresponding shadow space is the address space obtained by adding to it h'20000000 n (n = 1C6). the address range for area 7, which is on-chip i/o space, is h'1c000000 to h'1fffffff. the address space h'1c000000 + h'20000000 nCh'1fffffff + h'20000000 n (n = 0C7) corresponding to the area 7 shadow space is reserved, so do not use it. 10.1.6 pcmcia support this lsi supports pcmcia standard interface specifications in physical space areas 5 and 6. the interfaces supported are basically the "ic memory card interface" and "i/o card interface" stipulated in jeida specifications ver. 4.2 (pcmcia2.1). table 10.5 pcmcia interface characteristics item feature access random access data bus 8/16 bits memory type mask rom, otprom, eprom, eeprom, flash memory, sram memory capacity maximum 32 mbytes i/o space capacity maximum 32 mbytes others dynamic bus sizing of i/o bus width * the pcmcia interface can be accessed from the address translation area or non-address translation area. note: * dynamic bus sizing of i/o bus width is supported only in the little endian mode.
233 commom memory/attribute memory area 5: h'14000000 area 5: h'16000000 commom memory/attribute memory area 6: h'18000000 i/o space i/o space area 6: h'1a000000 figure 10.4 pcmcia space allocation table 10.6 pcmcia support interface ic memory card interface i/o card interface pin signal i/o function signal i/o function sh7709a pin 1 gnd ground gnd ground 2 d3 i/o data d3 i/o data d3 3 d4 i/o data d4 i/o data d4 4 d5 i/o data d5 i/o data d5 5 d6 i/o data d6 i/o data d6 6 d7 i/o data d7 i/o data d7 7 ce1 i card enable ce1 i card enable ce1a or ce1b 8 a10 i address a10 i address a10 9 oe i output enable oe i output enable rd 10 a11 i address a11 i address a11 11 a9 i address a9 i address a9 12 a8 i address a8 i address a8 13 a13 i address a13 i address a13 14 a14 i address a14 i address a14 15 we / pgm i write enable we / pgm i write enable we 16 rdy/ bsy o ready/busy ireq o ready/busy 17 v cc operation power v cc operation power 18 v pp1 program power v pp1 program/ peripheral power
234 table 10.6 pcmcia support interface (cont) ic memory card interface i/o card interface pin signal i/o function signal i/o function sh7709a pin 19 a16 i address a16 i address a16 20 a15 i address a15 i address a15 21 a12 i address a12 i address a12 22 a7 i address a7 i address a7 23 a6 i address a6 i address a6 24 a5 i address a5 i address a5 25 a4 i address a4 i address a4 26 a3 i address a3 i address a3 27 a2 i address a2 i address a2 28 a1 i address a1 i address a1 29 a0 i address a0 i address a0 30 d0 i/o data d0 i/o data d0 31 d1 i/o data d1 i/o data d1 32 d2 i/o data d2 i/o data d2 33 wp * o write protect iois16 o 16-bit i/o port iois16 34 gnd ground gnd ground 35 gnd ground gnd ground 36 cd1 o card detection cd1 o card detection 37 d11 i/o data d11 i/o data d11 38 d12 i/o data d12 i/o data d12 39 d13 i/o data d13 i/o data d13 40 d14 i/o data d14 i/o data d14 41 d15 i/o data d15 i/o data d15 42 ce2 i card enable ce2 i card enable ce2a or ce2b 43 vs1 i voltage sense 1 vs1 i voltage sense 1 44 rfu reserved iord i i/o read iciord 45 rfu reserved iowr i i/o write iciowr 46 a17 i address a17 i address a17 47 a18 i address a18 i address a18 48 a19 i address a19 i address a19 note: * this chip does not support wp.
235 table 10.6 pcmcia support interface (cont) ic memory card interface i/o card interface pin signal i/o function signal i/o function sh7709a pin 49 a20 i address a20 i address a20 50 a21 i address a21 i address a21 51 v cc power supply v cc power supply 52 v pp2 program power v pp2 program/ peripheral power 53 a22 i address a22 i address a22 54 a23 i address a23 i address a23 55 a24 i address a24 i address a24 56 a25 i address a25 i address a25 57 vs2 i voltage sense 2 vs2 i voltage sense 2 58 reset i reset reset i reset 59 wait o wait request wait o wait request 60 rfu reserved inpack o input acknowledge 61 reg i attribute memory space select reg i attribute memory space select 62 bvd2 o battery voltage detection spkr o digital voice signal 63 bvd1 o battery voltage detection stschg o card state change 64 d8 i/o data d8 i/o data d8 65 d9 i/o data d9 i/o data d9 66 d10 i/o data d10 i/o data d10 67 cd2 o card detection cd2 o card detection 68 gnd ground gnd ground
236 10.2 bsc registers 10.2.1 bus control register 1 (bcr1) bus control register 1 (bcr1) is a 16-bit read/write register that sets the functions and bus cycle state for each area. it is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or by standby mode. do not access external memory outside area 0 until bcr1 register initialization is complete. bit: 15 14 13 12 11 10 9 8 pula puld hizmem hizcnt endian a0bst1 a0bst0 a5bst1 initial value: 0 0 0 0 0/1 * 000 r/w: r/w r/w r/w r/w r r/w r/w r/w bit: 7 6 5 4 3 2 1 0 a5bst0 a6bst1 a6bst0 dram tp2 dram tp1 dram tp0 a5 pcm a6 pcm initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w note: * samples the value of the external pin (md5) designating endian at power-on reset. bit 15pin a25 to a0 pull-up (pula): specifies whether or not pins a25 to a0 are pulled up for 4 cycles immediately after back is asserted. bit 15: pula description 0 not pulled up (initial value) 1 pulled up bit 14pin d31 to d0 pull-up (puld): specifies whether or not pins d31 to d0 are pulled up when not in use. bit 14: puld description 0 not pulled up (initial value) 1 pulled up
237 bit 13hi-z memory control (hizmem): specifies the state of a25-0, bs , cs , rd/ wr , we /dqm, rd , ce2a , ce2b and drak0/1 in standby mode. bit 13: hizmem description 0 a25-0, bs, cs, rd/wr, we/dqm, rd, ce2a, ce2b and drak0/1 are hi-z in standby mode. (initial value) 1 a25-0, bs, cs, rd/wr, we/dqm, rd, ce2a, ce2b and drak0/1 are high in standby mode. bit 12high-z control (hizcnt): specifies the state of the ras and the cas signals at standby and bus right release. bit 12: hizcnt description 0 the ras and the cas signals are high-impedance state (high-z) at standby and bus right release. (initial value) 1 the ras and the cas signals are driven at standby and bus right release. bit 11endian flag (endian): samples the value of the external pin designating endian upon a power-on reset. endian for all physical spaces is decided by this bit, which is read-only. bit 11: endian description 0 (on reset) endian setting external pin (md5) is low. indicates the sh7709a is set as big endian. 1 (on reset) endian setting external pin (md5) is high. indicates the sh7709a is set as little endian. bits 10 and 9area 0 burst rom control (a0bst1, a0bst0): specify whether to use burst rom in physical space area 0. when burst rom is used, set the number of burst transfers. bit 10: a0bst1 bit 9: a0bst0 description 0 0 access area 0 as ordinary memory (initial value) 1 access area 0 as burst rom (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 1 0 access area 0 as burst rom (8 consecutive accesses). can be used when bus width is 8 or 16. 1 access area 0 as burst rom (16 consecutive accesses). can be used only when bus width is 8.
238 bits 8 and 7area 5 burst enable (a5bst1, a5bst0): specify whether to use burst rom and pcmcia burst mode in physical space area 5. when burst rom and pcmcia burst mode are used, set the number of burst transfers. bit 8: a5bst1 bit 7: a5bst0 description 0 0 access area 5 as ordinary memory (initial value) 1 burst access of area 5 (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 1 0 burst access of area 5 (8 consecutive accesses). can be used when bus width is 8 or 16. 1 burst access of area 5 (16 consecutive accesses). can be used only when bus width is 8. bits 6 and 5area 6 burst enable (a6bst1, a6bst0): specify whether to use burst rom and pcmcia burst mode in physical space area 6. when burst rom and pcmcia burst mode are used, set the number of burst transfers. bit 6: a6bst1 bit 5: a6bst0 description 0 0 access area 6 as ordinary memory (initial value) 1 burst access of area 6 (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 1 0 burst access of area 6 (8 consecutive accesses). can be used when bus width is 8 or 16. 1 burst access of area 6 (16 consecutive accesses). can be used only when bus width is 8.
239 bits 4 to 2area 2, area 3 memory type (dramtp2 to dramtp0): designate the types of memory connected to physical space areas 2 and 3. ordinary memory, such as rom, sram, or flash rom, can be directly connected. dram, and synchronous dram can also be directly connected. bit 4: dramtp2 bit 3: dramtp1 bit 2: dramtp0 description 0 0 0 areas 2 and 3 are ordinary memory (initial value) 1 reserved (setting disabled) 1 0 area 2: ordinary memory; area 3: synchronous dram 1 areas 2 and 3 are synchronous dram * 1 1 0 0 area 2: ordinary memory; area 3: dram 1 areas 2 and 3 are dram * 2 1 0 reserved (setting disabled) 1 reserved (setting disabled) notes: * 1 when selecting this mode, set the same bus width for area 2 and area 3. * 2 when selecting this mode, set the area 2 bus width as word. bit 1area 5 bus type (a5pcm): designates whether to access physical space area 5 as pcmcia space. bit 1: a5pcm description 0 access physical space area 5 as ordinary memory (initial value) 1 access physical space area 5 as pcmcia space bit 0area 6 bus type (a6pcm): designates whether to access physical space area 6 as pcmcia space. bit 0: a6pcm description 0 access physical space area 6 as ordinary memory (initial value) 1 access physical space area 6 as pcmcia space
240 10.2.2 bus control register 2 (bcr2) the bus control register 2 (bcr2) is a 16-bit read/write register that selects the bus-size width of each area. it is initialized to h'3ff0 by a power-on reset, but is not initialized by a manual reset or by standby mode. do not access external memory outside area 0 until bcr2 register initialization is complete. bit: 15 14 13 12 11 10 9 8 a6sz1 a6sz0 a5sz1 a5sz0 a4sz1 a4sz0 initial value: 0 0 1 1 1 1 1 1 r/w: r r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 a3sz1 a3sz0 a2sz1 a2sz0 initial value: 1 1 1 1 0 0 0 0 r/w: r/w r/w r/w r/w r r r r bits 15, 14, 3, 2, 1, and 0reserved: these bits are always read as 0. the write value should always be 0. bits 2n + 1, 2narea n (2C6) bus size specification (ansz1, ansz0): specify the bus sizes of physical space area n (n = 2 to 6). bit 2n + 1: ansz1 bit 2n: ansz0 port a / b description 0 0 unused reserved (setting disabled) 1 byte (8-bit) size 1 0 word (16-bit) size 1 longword (32-bit) size 0 0 used reserved (setting disabled) 1 byte (8-bit) size 1 0 word (16-bit) size 1 reserved (setting disabled)
241 10.2.3 bus control register 3 (bcr3) bus control register 3 (bcr3) is a 16-bit read/write register that specifies ras and cas timing for the dram (areas 2 and 3). this enables a large amount of data to be transferred efficiently, for example, when transferring image data. the bcr3 is initialized to h'0000 by power-on resets, but is not initialized by manual resets or in the standby mode. the bits extend, tpc31C30, rcd31C30, tras31C30, tpc21C20, rcd21C20, and tras21C20 are written to during the initialization after a power-on reset and are not modified again. bit: 15 14 13 12 11 10 9 8 ext end tpc31 tpc30 rcd31 rcd30 tras31 tras30 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 tpc21 tpc20 rcd21 rcd20 tras21 tras20 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w bit 15bsc dram access mode extended control (extend): the extend bit specifies the short pitch access mode to the dram (areas 2 and 3). setting the extend bit to 1 enables a single access to be performed in a minimum of two cycles (rcdn (1C0) = 00) to the dram, and a burst access to be performed in a pitch of one cycle for the second and later data. in addition, by setting the extend bit to 1, other bits of the bcr3 register (tpc31C30, scd31C30, tras31C 30, tpc21C20, rcd21C20, and tras21C20 become valid. bit 15: extend description 0 the bsc is set to normal mode. (initial value) 1 the bsc is set to extended mode. dram is accessed in a short pitch. bits 14, 7, and 6reserved: these bits are always read as 0. the write value should always be 0.
242 bits 13 and 12ras precharge time (tpc31, tpc30): when the extend bit in bcr3 is set to 1, the bsc uses the tpc (31-30) bits. when the dram interface is selected as the connected memory of area 3, the tpc bits set the minimum number of cycles for ras precharge until the next ras assertion after ras negation. set the same value for tpc31C30 and tpc21C20 in bcr3, tpc1C0 in the mcr, and tpc1C0 in the dcr. bit 13 bit 12 tpc31 tpc30 function 0 0 1 cycle (initial value) 0 1 2 cycles 1 0 3 cycles 1 1 4 cycles bits 11 and 10ras-cas delay (rcd31, rcd30): when the extend bit in bcr3 is set to 1, the bsc uses the rcd (31-30) bits in place of the rcd (1-0) bits in the mcr. when the dram interface is selected as the connected memory of area 3, these bits set the ras-cas assert delay. bit 11 bit 10 rcd31 rcd30 function 0 0 1 cycle (initial value) 0 1 2 cycles 1 0 3 cycles 1 1 4 cycles bits 9 and 8cas-before-ras refresh ras assert time (tras31, tras30): when the extend bit in bcr3 is set to 1, the bsc uses the tras (31C30) bits. when the dram interface is selected as the connected memory of area 3, these bits set the ras assert period for cas-before-ras refreshes. set the same value for tras31C30 and tras21C20 in bcr3, tras 1C0 in the mcr, and tras 1C0 in the dcr. bit 9 bit 8 tras31 tras30 function 0 0 2 cycles (initial value) 0 1 3 cycles 1 0 4 cycles 1 1 5 cycles
243 bits 5 and 4ras precharge time (tpc21, tpc20): when the extend bit in bcr3 is set to 1, the bsc uses the tpc (21C20) bits. when the dram interface is selected as the connected memory of area 2, the tpc bits set the minimum number of cycles for ras precharge until the next ras assertion after ras negation. bit 5 bit 4 function tpc21 tpc20 normal after self refresh 0 0 1 cycle (initial value) 2 cycles (initial value) 0 1 2 cycles 5 cycles 1 0 3 cycles 8 cycles 1 1 4 cycles 11 cycles bits 3 and 2ras-cas delay (rcd21, rcd20): when the extend bit in bcr3 is set to 1, the bsc uses the rcd (21C20) bits in place of the rcd (1C0) bits in the dcr. the ras-cas delay is set for the dram interface connected to area 2. bit 3 bit 2 rcd21 rcd20 function 0 0 1 cycle (initial value) 0 1 2 cycles 1 0 3 cycles 1 1 4 cycles bits 1 and 0cas-before-ras refresh ras assert time (tras21, tras20): when the extend bit in bcr3 is set to 1, the bsc uses the tras (21C20) bits in place of the tras (1C0) bits in the dcr. the ras assert time is set for the dram interface connected to area 2 when cas-before-ras refreshes. bit 1 bit 0 tras21 tras20 function 0 0 2 cycles (initial value) 0 1 3 cycles 1 0 4 cycles 1 1 5 cycles bits 14, 7, and 6reserved: these bits are always read as 0. the write value should always be 0.
244 10.2.4 wait state control register 1 (wcr1) wait state control register 1 (wcr1) is a 16-bit read/write register that specifies the number of idle (wait) state cycles inserted for each area. for some memories, the drive of the data bus may not be turned off quickly even when the read signal from the external device is turned off. this can result in conflicts between data buses when consecutive memory accesses are to different memories or when a write immediately follows a memory read. this lsi automatically inserts idle states equal to the number set in wcr1 in those cases. wcr1 is initialized to h'3ff3 by a power-on reset. it is not initialized by a manual reset or by standby mode. bit: 15 14 13 12 11 10 9 8 waitsel a6iw1 a6iw0 a5iw1 a5iw0 a4iw1 a4iw0 initial value: 0 0 1 1 1 1 1 1 r/w: r/w r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 a3iw1 a3iw0 a2iw1 a2iw0 a0iw1 a0iw0 initial value: 1 1 1 1 0 0 1 1 r/w: r/w r/w r/w r/w r r r/w r/w bit 15wait sampling timing select (waitsel): specifies the wait signal sampling timing. bit 15: waitsel description 0 sampled at rise of ckio. in this case, the wait signal must be input synchronously (initial value) 1 sampled at fall of ckio. in this case, the wait signal can be input asynchronously bits 14, 3, and 2 reserved: these bits are always read as 0. the write value should always be 0. bits 2n + 1, 2narea n (6C2, 0) intercycle idle specification (aniw1, aniw0): specify the number of idles inserted between bus cycles when switching between physical space area n (6C2, 0) to another space or between a read access to a write access in the same physical space.
245 bit 2n + 1: aniw1 bit 2n: aniw0 description 0 0 1 idle cycle inserted 1 1 idle cycle inserted 1 0 2 idle cycles inserted 1 3 idle cycles inserted (initial value) 10.2.5 wait state control register 2 (wcr2) wait state control register 2 (wcr2) is a 16-bit read/write register that specifies the number of wait state cycles inserted for each area. it also specifies the pitch of data access for burst memory accesses. this allows direct connection of even low-speed memories without an external circuit. wcr2 is initialized to h'ffff by a power-on reset. it is not initialized by a manual reset or by standby mode. bit: 15 14 13 12 11 10 9 8 a6 w2 a6 w1 a6 w0 a5 w2 a5 w1 a5 w0 a4 w2 a4 w1 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 a4 w0 a3 w1 a3 w0 a2 w1 a2 w0 a0 w2 a0 w1 a0 w0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
246 bits 15 to 13area 6 wait control (a6w2 to a6w0): specify the number of wait states inserted into physical space area 6. also specify the burst pitch for burst transfer. description first cycle burst cycle (excluding first cycle) bit 15: a6w2 bit 14: a6w1 bit 13: a6w0 inserted wait states wait pin number of states per data transfer wait pin 0 0 0 0 disable 2 enable 1 1 enable 2 enable 1 0 2 enable 3 enable 1 3 enable 4 enable 1 0 0 4 enable 4 enable 1 6 enable 6 enable 1 0 8 enable 8 enable 110 (initial value) enable 10 enable bits 12 to 10area 5 wait control (a5w2 to a5w0): specify the number of wait states inserted into physical space area 5. also specify the burst pitch for burst transfer. description first cycle burst cycle (excluding first cycle) bit 12: a5w2 bit 11: a5w1 bit 10: a5w0 inserted wait states wait pin number of states per data transfer wait pin 0 0 0 0 disable 2 enable 1 1 enable 2 enable 1 0 2 enable 3 enable 1 3 enable 4 enable 1 0 0 4 enable 4 enable 1 6 enable 6 enable 1 0 8 enable 8 enable 110 (initial value) enable 10 enable
247 bits 9 to 7area 4 wait control (a4w2 to a4w0): specify the number of wait states inserted into physical space area 4. description bit 9: a4w2 bit 8: a4w1 bit 7: a4w0 inserted wait state wait pin 0000 ign ored 1 1 enable 1 0 2 enable 1 3 enable 1004 en able 1 6 enable 1 0 8 enable 1 10 enable (initial value) bits 6 and 5area 3 wait control (a3w1, a3w0): specify the number of wait states inserted into physical space area 3. when the dram is used for area 3 and the extend bit of bcr3 is set, the bsc ignores bits 6 and 5. ? for ordinary memory description bit 6: a3w1 bit 5: a3w0 inserted wait states wait pin 0 0 0 ignored 1 1 enable 1 0 2 enable 1 3 enable (initial value) ? for dram, synchronous dram description bit 6: a3w1 bit 5: a3w0 dram: cas assert period synchronous dram: cas latency 001 1 11 1 102 2 1 3 3 (initial value)
248 bits 4 and 3area 2 wait control (a2w1, a2w0): specify the number of wait states inserted into physical space area 2. when the dram is used for area 2 and the extend bit of the bcr3 is set, the bsc ignores bits 4 and 3. ? for ordinary memory description bit 4: a2w0 bit 3: a2w0 inserted wait states wait pin 0 0 0 ignored 1 1 enable 1 0 2 enable 1 3 enable (initial value) ? for dram, synchronous dram description bit 4: a2w1 bit 3: a2w0 dram: cas assert period synchronous dram: cas latency 001 1 11 1 102 2 1 3 3 (initial value) bits 2 to 0area 0 wait control (a0w2 to a0w0): specify the number of wait states inserted into physical space area 0. also specify the burst pitch for burst transfer. description first cycle burst cycle (excluding first cycle) bit 2: a0w2 bit 1: a0w1 bit 0: a0w0 inserted wait states wait pin number of states per data transfer wait pin 0 0 0 0 ignored 2 enable 1 1 enable 2 enable 1 0 2 enable 3 enable 1 3 enable 4 enable 1 0 0 4 enable 4 enable 1 6 enable 6 enable 1 0 8 enable 8 enable 110 (initial value) enable 10 enable
249 10.2.6 individual memory control register (mcr) the individual memory control register (mcr) is a 16-bit read/write register that specifies ras and cas timing and burst control for dram(area 3 only), synchronous dram (areas 2 and 3), specifies address multiplexing, and controls refresh. this enables direct connection of dram, and synchronous dram without external circuits. the mcr is initialized to h'0000 by power-on resets, but is not initialized by manual resets or standby mode. the bits tpc1Ctpc0, rcd1Crcd0, trwl1Ctrwl0, tras1Ctras0, rasd, be, amx2Camx0, and edomode are written to at the initialization after a power-on reset and are not then modified again. when rfsh and rmode are written to, write the same values to the other bits. when using dram, and synchronous dram, do not access areas 2 and 3 until this register is initialized. bit: 15 14 13 12 11 10 9 8 tpc1 tpc0 rcd1 rcd0 trwl1 trwl0 tras1 tras0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 rasd be amx2 amx1 amx0 rfsh rmode edo mode initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14ras precharge time (tpc1, tpc0): when dram interface is selected as connected memory, the tpc bits set the minimum number of cycles until the next ras assertion after ras negation. when synchronous dram interface is selected, they set the minimum number of cycles until output of the next bank-active command after precharge. the number of cycles inserted immediately after issuing the precharge all banks command (pall) in auto- refreshing or precharge command (pre) in bank active mode is one less than the normal value. in bank active mode, do not set tpc1 = 0 and tpc0 = 0. set the same value for tpc31C30 and tpc21C20 in bcr3, tpc1C0 in the mcr, and tpc1C0 in the dcr.
250 description bit 15: tpc1 bit 14: tpc0 normal operation * immediately after precharge command * immediately after self-refresh 0 0 1 cycle (initial value) 0 cycle (initial value) 2 cycles (initial value) 1 2 cycles 1 cycle 5 cycles 1 0 3 cycles 2 cycles 8 cycles 1 4 cycles 3 cycles 11 cycles note: * immediately after precharge all banks (pall) command in auto-refreshing or precharge (pre) command in bank active mode bits 13 and 12rasCcas delay (rcd1, rcd0): the rcd bits set the rasCcas assert delay time for the connected memory when dram interface is selected. when synchronous dram interface is selected, sets the bank active read/write command delay time. when the extend bit of bcr3 is set, the bsc ignores the rcd bits. bit 13: rcd1 bit 12: rcd0 description 0 0 1 cycle (initial value) 1 2 cycles 1 0 3 cycles 1 4 cycles bits 11 and 10write-precharge delay (trwl1, trwl0): the trwl bits set the synchronous dram write-precharge delay time. this designates the time between the end of a write cycle and the next bank-active command. this is valid only when synchronous dram is connected. after the write cycle, the next bank-active command is not issued for the period tpc + trwl. bit 11: trwl1 bit 10: trwl0 description 0 0 1 cycle (initial value) 1 2 cycles 1 0 3 cycles 1 reserved (setting disabled) bits 9 and 8 cas -before- ras refresh ras assert time (tras1, tras0): when dram interface is selected as connected memory, the tras bits set the ras assertion period for cas - before- ras refreshes. when synchronous dram interface is selected, no bank-active command is issues during the period tpc + tras after an auto-refresh command. set the same value for tras31C30 and tras21C20 in bcr3, tras1C0 in the mcr, and tras1C0 in the dcr.
251 bit 9: tras1 bit 8: tras0 description 0 0 2 cycles (initial value) 1 3 cycles 1 0 4 cycles 1 5 cycles bit 7synchronous dram bank active (rasd): specifies whether synchronous dram is used in bank active mode or auto-precharge mode. set auto-precharge mode when areas 2 and 3 are both designated as synchronous dram space, or when 16 bits is set as the bus width. bit 7: rasd description 0 auto-precharge mode (initial value) 1 bank active mode bit 6burst enable (be): the be bit specifies whether to conduct a burst access of dram. when accessing synchronous dram, burst access is always carried out, regardless of this bits designation. bit 6: be description 0 burst disabled (initial value) 1 when dram interface, do a high-speed page mode access bits 5 and 3address multiplex (amx2 to amx0): the amx bits specify address multiplexing for dram and synchronous dram. the actual address shift value differs between dram interface and synchronous dram interface.
252 for dram interface: bit 5: amx2 bit 4: amx1 bit 3: amx0 description 0 0 0 the row address begins with a9. (the a9 value is output at a1 when the row address is output.) (initial value) 1 the row address begins with a10. (the a10 value is output at a1 when the row address is output.) 1 0 the row address begins with a11. (the a11 value is output at a1 when the row address is output.) 1 the row address being with a12. (the a12 value is output at a1 when the row address is output.) 1 0 0 (reserved) 1 (reserved) 1 0 (reserved) 1 (reserved) for synchronous dram interface: bit5: amx2 bit 4: amx1 bit 3: amx0 description 1 0 0 the row address begins with a9 . (the a9 value is output at a1 when the row address is output. 4 m 16-bit products) (initial value) 1 the row address begins with a10 . (the a10 value is output at a1 when the row address is output. 8 m 8-bit products) 1 0 the row address begins with a11 . (the a11 value is output at a1 when the row address is output. 16 m 4-bit products) * 1 1 the row address begins with a9 . (the a9 value is output at a1 when the row address is output. 2 m 32-bit products) * 2 0 0 0 the row address begins with a9 . (the a9 value is output at a1 when the row address is output. 1 m 16-bit products) (initial value) 1 the row address begins with a10 . (the a10 value is output at a1 when the row address is output. 2 m 8-bit products) * 2 1 0 the row address begins with a11 . (the a11 value is output at a1 when the row address is output. 4 m 4-bit products) 1 the row address begins with a9 . (the a9 value is output at a1 when the row address is output. 256 k 16-bit products) notes: * 1 can only be set when using a 16-bit bus width. * 2 can only be set when using a 32-bit bus width.
253 bit 2refresh control (rfsh): the rfsh bit determines whether or not the refresh operation of the dram and synchronous dram is performed. the timer for generation of the refresh request frequency can also be used as an interval timer. bit 2: rfsh description 0 no refresh (initial value) 1 refresh bit 1refresh mode (rmode): the rmode bit selects whether to perform an ordinary refresh or a self-refresh when the rfsh bit is 1. when the rfsh bit is 1 and this bit is 0, a cas- before-ras refresh or an auto-refresh is performed on dram or synchronous dram at the period set by the refresh-related registers rtcnt, rtcor and rtcsr. when a refresh request occurs during an external bus cycle, the bus cycle will be ended and the refresh cycle performed. when the rfsh bit is 1 and this bit is also 1, the dram or synchronous dram will wait for the end of any executing external bus cycle before going into a self-refresh. all refresh requests to memory that is in the self-refresh state are ignored. bit 1: rmode description 0 cas-before-ras refresh (rfsh must be 1) (initial value) 1 self-refresh (rfsh must be 1) bit 0edo mode (edomode): the edomode bit specifies the data sampling timing during data reads when using dram in edo mode. operating timing of memory other than dram does not change even if this bit is set. this bit is only valid for dram connected to area 3. do not set this bit to 1 when using synchronous dram. bit 0: edomode description 0 set when using normal dram. data sampling timing during read cycle is on the falling edge of ckio. (initial value) 1 set when using the edo-mode dram. data sampling timing during read cycle is on the rising edge of ckio. also, ras signal negate timing is delayed 1/2 machine cycle.
254 10.2.7 dram control register (dcr) the dram control register (dcr) is a 16-bit read/write register that specifies ras and cas timing and burst control for dram connected to area 2. it also specifies address multiplexing and controls refresh. when dram is connected to area 2, the bus width is fixed at 16 bits. the dcr is initialized to h'0000 by power-on resets, but is not initialized by manual resets or standby mode. do not access external memory outside area 2 until this registers initialization is complete. bit: 15 14 13 12 11 10 9 8 tpc1 tpc0 rcd1 rcd0 tras1 tras0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r r/w r/w bit: 7 6 5 4 3 2 1 0 be amx1 amx0 rfsh rmode initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r/w r/w r/w r bits 15 and 14ras precharge time (tpc1, tpc0): the tpc bits set the ras precharge time for the dram connected to area 2. set the same value for tpc31C30 and tpc21C20 in bcr3, tpc1C0 in the mcr, and tpc1C0 in the dcr. bit 15: tpc1 bit 14: tpc0 description 0 0 1 cycle (initial value) 1 2 cycles 1 0 3 cycles 1 4 cycles bits 13 and 12rasCcas delay (rcd1, rcd0): the rcd bits set the rasCcas delay time for the dram connected to area 2. when the bcr3 extend bit is set, the bscp ignores bits 13 and 12. bit 13: rcd1 bit 12: rcd0 description 0 0 1 cycle (initial value) 1 2 cycles 1 0 3 cycles 1 4 cycles
255 bits 11, 10, 7, 5, and 0reserved: these bits are always read as 0. the write value should always be 0. bits 9 and 8cas-before-ras refresh ras assert time (tras1, tras0): the tras bits set timing for the dram connected to area 2. these bits set the ras assert period for cas- before-ras refreshes. set the same value for tras31C30 and tras21C20 in bcr3, tras1C0 in the mcr, and tras1C0 in the dcr. bit 9: tras1 bit 8: tras0 description 0 0 2 cycles (initial value) 1 3 cycles 1 0 4 cycles 1 5 cycles bit 6burst enable (be): the be bit specifies whether to conduct a burst access of the dram connected to area 2. bit 6: be description 0 burst disabled (initial value) 1 high-speed page mode access bits 4 and 3address multiplex (amx1, amx0): the amx bits specify address multiplexing for the dram connected to area 2. bit 4: amx1 bit 3: amx0 description 0 0 8-bit column-address products (initial value) 1 9-bit column-address products 1 0 10-bit column-address products 1 11-bit column-address products bit 2refresh control (rfsh): the rfsh bit determines whether or not the refresh operation of the dram connected to area 2 is performed . bit 2: rfsh description 0 no refresh (initial value) 1 refresh
256 bit 1refresh mode (rmode): the rmode bit selects the refresh mode for the dram connected to area 2. bit 1: rmode description 0 cas-before-ras refresh (rfsh must be 1) (initial value) 1 self-refresh (rfsh must be 1) bits 11, 10, 7, 5, and 0reserved: these bits are always read as 0. the write value should always be 0. 10.2.8 pcmcia control register (pcr) the pcmcia control register (pcr) is a 16-bit readable/writable register that specifies the assertion and negation timing of the oe and we signals for the pcmcia interface connected to areas 5 and 6. the oe and we signal assertion width is set by the wait control bits in the wcr2 register. pcr is initialized to h'0000 by a power-on reset, but is not initialized, and retains its contents, in a manual reset and in standby mode. bit: 15 14 13 12 11 10 9 8 a6w3 a5w3 a5ted2 a6ted2 a5teh2 a6teh2 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 a5ted1 a5ted0 a6ted1 a6ted0 a5teh1 a5teh0 a6teh1 a6teh0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
257 bit 15area 6 wait control (a6w3): the a6w3 bit specifies the number of inserted wait states for area 6 combined with bits a6w2Ca6w0 in wcr2. it also specifies the number of transfer states in burst transfer. set this bit to 0 when area 6 is not set to pcmcia. top cycle burst cycle a6w3 a6w2 a6w1 a6w0 inserted wait state wait pin number of states per one-data transfer wait pin 00000 ign ored 2 enabled 00011 en abled 2 enabled 00102 en abled 3 enabled 00113 en abled 4 enabled 01004 en abled 5 enabled 01016 en abled 7 enabled 01108 en abled 9 enabled 011110 (initial value) enabled 11 enabled 100012 en abled 13 enabled 100114 en abled 15 enabled 101018 en abled 19 enabled 101122 en abled 23 enabled 110026 en abled 27 enabled 110130 en abled 31 enabled 111034 en abled 35 enabled 111138 en abled 39 enabled bit 14area 5 wait control (a5w3): the a5w3 bit specifies the number of inserted wait states for area 5 combined with bits a5w2Ca5w0 in wcr2. it also specifies the number of transfer states in burst transfer. set this bit to 0 when area 5 is not set to pcmcia. the relationship between the setting value and the number of waits is the same as a6w3. bits 13 and 12reserved: these bits are always read as 0. the write value should always be 0.
258 bits 11, 7, and 6area 5 address oe/we assert delay (a5ted2 to a5ted0): the a5ted bits specify the address to oe/we assert delay time for the pcmcia interface connected to area 5. bit 11: a5ted2 bit 7: a5ted1 bit 6: a5ted0 description 0 0 0 0.5-cycle delay (initial value) 1 1.5-cycle delay 1 0 2.5-cycle delay 1 3.5-cycle delay 1 0 0 4.5-cycle delay 1 5.5-cycle delay 1 0 6.5-cycle delay 1 7.5-cycle delay bits 10, 5, and 4area 6 address oe/we assert delay (a6ted2 to a6ted0): the a6ted bits specify the address to oe/we assert delay time for the pcmcia interface connected to area 6. bit 10: a6ted2 bit 5: a6ted1 bit 4: a6ted0 description 0 0 0 0.5-cycle delay (initial value) 1 1.5-cycle delay 1 0 2.5-cycle delay 1 3.5-cycle delay 1 0 0 4.5-cycle delay 1 5.5-cycle delay 1 0 6.5-cycle delay 1 7.5-cycle delay
259 bits 9, 3, and 2area 5 oe/we negate address delay (a5teh2 to a5teh0): the a5teh bits specify the oe/we negate address delay time for the pcmcia interface connected to area 5. bit 9: a5teh2 bit 3: a5teh1 bit 2: a5teh0 description 0 0 0 0.5-cycle delay (initial value) 1 1.5-cycle delay 1 0 2.5-cycle delay 1 3.5-cycle delay 1 0 0 4.5-cycle delay 1 5.5-cycle delay 1 0 6.5-cycle delay 1 7.5-cycle delay bits 8, 1, and 0area 6 oe/we negate address delay (a6teh2 to a6teh0): the a6teh bits specify the oe/we negate address delay time for the pcmcia interface connected to area 6. bit 8: a6teh2 bit 1: a6teh1 bit 0: a6teh0 description 0 0 0 0.5-cycle delay (initial value) 1 1.5-cycle delay 1 0 2.5-cycle delay 1 3.5-cycle delay 1 0 0 4.5-cycle delay 1 5.5-cycle delay 1 0 6.5-cycle delay 1 7.5-cycle delay
260 10.2.9 synchronous dram mode register (sdmr) the synchronous dram mode register (sdmr) is written to via the synchronous dram address bus and is an 8-bit write-only register. it sets synchronous dram mode for areas 2 and 3. sdmr is undefined after a power-on reset. the register contents are not initialized by a manual reset or standby mode; values remain unchanged. writes to the synchronous dram mode register use the address bus rather than the data bus. if the value to be set is x and the sdmr address is y, the value x is written in the synchronous dram mode register by writing in address x + y. since, with a 32-bit bus width, a0 of the synchronous dram is connected to a2 of the chip and a1 of the synchronous dram is connected to a3 of the chip, the value actually written to the synchronous dram is the x value shifted two bits right. with a 16-bit bus width, the value written is the x value shifted one bit right. for example, with a 32-bit bus width, when h'0230 is written to the sdmr register of area 2, random data is written to the address h'ffffd000 (address y) + h'08c0 (value x), or h'ffffd8c0. as a result, h'0230 is written to the sdmr register. the range for value x is h0000 to h0ffc. when h'0230 is written to the sdmr register of area 3, random data is written to the address h'ffffe000 (address y) + h'08c0 (value x), or h'ffffe8c0. as a result, h'0230 is written to the sdmr register. the range for value x is h'0000 to h'0ffc. bit: 31 12 11 10 9 8 sdmr address initial value: ...................... r/w: ...................... w * w * ww bit: 7 6 5 4 3 2 1 0 initial value: r/w: w w w w w w w note: * depending on the type of synchronous dram.
261 10.2.10 refresh timer control/status register (rtcsr) the refresh timer control/status register (rtcsr) is a 16-bit read/write register that specifies the refresh cycle, whether to generate an interrupt, and that interrupts cycle. it is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or standby mode. note: writing to the rtcsr differs from that to general registers to ensure the rtcsr is not rewritten incorrectly. use the word-transfer instruction to set the upper byte as b'10100101 and the lower byte as the write data. for details, see section 10.2.14, cautions on accessing refresh control related registers. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 cmf cmie cks2 cks1 cks0 ovf ovie lmts initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 8reserved: these bits are always read as 0. bit 7compare match flag (cmf): the cmf status flag indicates that the values of rtcnt and rtcor match. bit 7: cmf description 0 the values of rtcnt and rtcor do not match. clear condition: when a refresh is performed after 0 has been written in cmf and rfsh = 1 and rmode = 0 (to perform a cbr refresh). (initial value) 1 the values of rtcnt and rtcor match. set condition: rtcnt = rtcor * note: * contents do not change when 1 is written to cmf.
262 bit 6compare match interrupt enable (cmie): enables or disables an interrupt request caused when the cmf of rtcsr is set to 1. do not set this bit to 1 when using cas-before-ras refresh or auto-refresh. bit 6: cmie description 0 disables an interrupt request caused by cmf (initial value) 1 enables an interrupt request caused by cmf bits 5 to 3clock select bits (cks2 to cks0): select the clock input to rtcnt. the source clock is the external bus clock (bclk). the rtcnt count clock is ckio divided by the specified ratio. the specified ratios are shown below in the normal external bus clock and when setting the external bus clock to 1/4 by setting the slpfrq bit in frqcr to 1 in sleep mode. description bit 5: cks2 bit 4: cks1 bit 3: cks0 normal external bus clock 1/4-bus clock 0 0 0 disables clock input disables clock input (initial value) 1 bus clock (ckio)/4 ckio/1 1 0 ckio/16 ckio/4 1 ckio/64 ckio/16 1 0 0 ckio/256 ckio/64 1 ckio/1024 ckio/256 1 0 ckio/2048 ckio/512 1 ckio/4096 ckio/1024 bit 2refresh count overflow flag (ovf): the ovf status flag indicates when the number of refresh requests indicated in the refresh count register (rfcr) exceeds the limit set in the lmts bit of rtcsr. bit 2: ovf description 0 rfcr has not exceeded the count limit value set in lmts clear conditions: when 0 is written to ovf (initial value) 1 rfcr has exceeded the count limit value set in lmts set conditions: when the rfcr value has exceeded the count limit value set in lmts * note: * contents dont change when 1 is written to ovf.
263 bit 1refresh count overflow interrupt enable (ovie): ovie selects whether to suppress generation of interrupt requests by ovf when the ovf bit of rtcsr is set to 1. bit 1: ovie description 0 disables interrupt requests from the ovf (initial value) 1 enables interrupt requests from the ovf bit 0refresh count overflow limit select (lmts): indicates the count limit value to be compared to the number of refreshes indicated in the refresh count register (rfcr). when the value rfcr overflows the value specified by lmts, the ovf flag is set. bit 0: lmts description 0 count limit value is 1024 (initial value) 1 count limit value is 512 10.2.11 refresh timer counter (rtcnt) rtcnt is a 16-bit read/write register. rtcnt is an 8-bit counter that counts up with input clocks. the clock select bits (cks2Ccks0) of rtcsr select the input clock. when rtcnt matches rtcor, the cmf bit of rtcsr is set and rtcnt is cleared. rtcnt is initialized to h'00 by a power-on reset; it continues incrementing after a manual reset; it is not initialized by standby mode and holds its values unchanged. note: writing to the rtcnt differs from that to general registers to ensure the rtcnt is not rewritten incorrectly. use the word-transfer instruction to set the upper byte as b'10100101 and the lower byte as the write data. for details, see section 10.2.14, cautions on accessing refresh control related registers. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
264 10.2.12 refresh time constant register (rtcor) the refresh time constant register (rtcor) is a 16-bit read/write register. the values of rtcor and rtcnt (bottom 8 bits) are constantly compared. when the values match, the compare match flag (cmf) of rtcsr is set and rtcnt is cleared to 0. when the refresh bit (rfsh) of the individual memory control register (mcr) is set to 1 and the refresh mode is set to cas-before- ras refresh, a memory refresh cycle occurs when the cmf bit is set. rtcor is initialized to h'00 by a power-on reset. it is not initialized by a manual reset or standby mode, but holds its contents. make the rtcor setting before setting bits cks2 to cks0 in rtcsr. note: writing to the rtcor differs from that to general registers to ensure the rtcor is not rewritten incorrectly. use the word-transfer instruction to set the upper byte as b'10100101 and the lower byte as the write data. for details, see section 10.2.14, cautions on accessing refresh control related registers. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 10.2.13 refresh count register (rfcr) the refresh count register (rfcr) is a 16-bit read/write register. it is a 10-bit counter that increments every time rtcor and rtcnt match. when rfcr exceeds the count limit value set in the lmts of rtcsr, rtcsrs ovf bit is set and rfcr clears. rfcr is initialized to h'0000 when a power-on reset is performed. it is not initialized by a manual reset or standby mode, but holds its contents. note: writing to the rfcr differs from that to general registers to ensure the rfcr is not rewritten incorrectly. use the word-transfer instruction to set the msb and followed six bits of upper bytes as b'101001 and remaining bits as the write data. for details, see section 10.2.14, cautions on accessing refresh control related registers.
265 bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 10.2.14 cautions on accessing refresh control related registers rfcr, rtcsr, rtcnt, and rtcor require that a specific code be appended to the data when it is written to prevent data from being mistakenly overwritten by program overruns or other write operations (figure 10.5). perform reads and writes using the following methods: 1. when writing to rfcr, rtcsr, rtcnt, and rtcor, use only word transfer instructions. you cannot write with byte transfer instructions. when writing to rtcnt, rtcsr, or rtcor, place b'10100101 in the upper byte and the write data in the lower byte. when writing to rfcr, place b'101001 in the top 6 bits and the write data in the remaining bits, as shown in figure 10.5. 15 10 8 rtcsr, rtcnt, rtcor 0 rfcr 7 100101 15 10 10 0 9 1 0 0 1 write data write data figure 10.5 writing to rfcr, rtcsr, rtcnt, and rtcor 2. when reading from rfcr, rtcsr, rtcnt, and rtcor, carry out reads with 16-bit width. 0 is read out from undefined bit sections.
266 10.2.15 mcs0 control register (mcscr0) the mcs0 control register (mcscr0) is a 16-bit read/write register that specifies the mcs[0] pin output conditions. mcscr[0] is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or in standby mode. as the mcs[0] pin is multiplexed as the ptc0 pin, when using the pin as mcs[0] , bits pc0md[1:0] in the pccr register should be set to 00 (other function). bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 cs2/0 cap1 cap0 a25 a24 a23 a22 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 7reserved: these bits are always read as 0. the write value should always be 0. bit 6cs2/cs0 select (cs2/0): selects whether an area 2 or area 0 address is to be decoded. bit 6: cs2/0 description 0 area 0 is selected 1 area 2 is selected bits 5 and 4connected memory size specification (cap1, cap0) bit 5: cap1 bit 4: cap0 description 0 0 32-mbit memory is connected 0 1 64-mbit memory is connected 1 0 128-mbit memory is connected 1 1 256-mbit memory is connected bits 3 to 0start address specification (a25 to a22): these bits specify the start address of the memory area for which mcs[0] is asserted.
267 10.2.16 mcs1 control register (mcscr1) the mcs1 control register (mcscr1) specifies the mcs[1] pin output conditions. the bit configuration and functions are the same as those of mcscr0. 10.2.17 mcs2 control register (mcscr2) the mcs2 control register (mcscr2) specifies the mcs[2] pin output conditions. the bit configuration and functions are the same as those of mcscr0. 10.2.18 mcs3 control register (mcscr3) the mcs3 control register (mcscr3) specifies the mcs[3] pin output conditions. the bit configuration and functions are the same as those of mcscr0. 10.2.19 mcs4 control register (mcscr4) the mcs4 control register (mcscr4) specifies the mcs[4] pin output conditions. the bit configuration and functions are the same as those of mcscr0. 10.2.20 mcs5 control register (mcscr5) the mcs5 control register (mcscr5) specifies the mcs[5] pin output conditions. the bit configuration and functions are the same as those of mcscr0. 10.2.21 mcs6 control register (mcscr6) the mcs6 control register (mcscr6) specifies the mcs[6] pin output conditions. the bit configuration and functions are the same as those of mcscr0. 10.2.22 mcs7 control register (mcscr7) the mcs7 control register (mcscr7) specifies the mcs[7] pin output conditions. the bit configuration and functions are the same as those of mcscr0.
268 10.3 bsc operation 10.3.1 endian/access size and data alignment this lsi supports both big endian, in which the 0 address is the most significant byte in the byte data, and little endian, in which the 0 address is the least significant byte. this switchover is designated by an external pin (md5 pin) at the time of a power-on reset. after a power-on reset, big endian is engaged when md5 is low; little endian is engaged when md5 is high. three data bus widths are available for ordinary memory (byte, word, longword) and two data bus widths (word and longword) for dram and synchronous dram. for the pcmcia interface, choose from byte and word. this means data alignment is done by matching the devices data width and endian. the access unit must also be matched to the devices bus width. this also means that when longword data is read from a byte-width device, the read operation must happen 4 times. in this lsi, data alignment and conversion of data length is performed automatically between the respective interfaces. tables 10.7 through 10.12 show the relationship between endian, device data width, and access unit. table 10.7 32-bit external device/big endian access and data alignment data bus strobe signals operation d31Cd24 d23Cd16 d15Cd8 d7Cd0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll byte access at 0 data 7C0 assert byte access at 1 data 7C0 assert byte access at 2 data 7C0 assert byte access at 3 data 7C0 assert word access at 0 data 15C8 data 7C0 assert assert word access at 2 data 15C8 data 7C0 assert assert longword access at 0 data 31C24 data 23C16 data 15C8 data 7C0 assert assert assert assert
269 table 10.8 16-bit external device/big endian access and data alignment data bus strobe signals operation d31C d24 d23C d16 d15Cd8 d7Cd0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll byte access at 0 data 7C0 assert byte access at 1 data 7C0 assert byte access at 2 data 7C0 assert byte access at 3 data 7C0 assert word access at 0 data 15C8 data 7C0 assert assert word access at 2 data 15C8 data 7C0 assert assert longword access 1st time at 0 data 31C24 data 23C16 assert assert at 0 2nd time at 2 data 15C8 data 7C0 assert assert
270 table 10.9 8-bit external device/big endian access and data alignment data bus strobe signals operation d31C d24 d23C d16 d15C d8 d7Cd0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll byte access at 0 data 7C0 assert byte access at 1 data 7C0 assert byte access at 2 data 7C0 assert byte access at 3 data 7C0 assert word access at 0 1st time at 0 data 15C8 assert 2nd time at 1 data 7C0 assert word access at 2 1st time at 2 data 15C8 assert 2nd time at 3 data 7C0 assert longword access at 0 1st time at 0 data 31C24 assert 2nd time at 1 data 23C16 assert 3rd time at 2 data 15C8 assert 4th time at 3 data 7C0 assert
271 table 10.10 32-bit external device/little endian access and data alignment data bus strobe signals operation d31Cd24 d23Cd16 d15Cd8 d7Cd0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll byte access at 0 data 7C0 assert byte access at 1 data 7C0 assert byte access at 2 data 7C0 assert byte access at 3 data 7C0 assert word access at 0 data 15C8 data 7C0 assert assert word access at 2 data 15C8 data 7C0 assert assert longword access at 0 data 31C24 data 23C16 data 15C8 data 7C0 assert assert assert assert
272 table 10.11 16-bit external device/little endian access and data alignment data bus strobe signals operation d31C d24 d23C d16 d15Cd8 d7Cd0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll byte access at 0 data 7C0 assert byte access at 1 data 7C0 assert byte access at 2 data 7C0 assert byte access at 3 data 7C0 assert word access at 0 data 15C8 data 7C0 assert assert word access at 2 data 15C8 data 7C0 assert assert longword access 1st time at 0 data 15C8 data 7C0 assert assert at 0 2nd time at 2 data 31C24 data 23C16 assert assert
273 table 10.12 8-bit external device/little endian access and data alignment data bus strobe signals operation d31C d24 d23C d16 d15C d8 d7Cd0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll byte access at 0 data 7C0 assert byte access at 1 data 7C0 assert byte access at 2 data 7C0 assert byte access at 3 data 7C0 assert word access at 0 1st time at 0 data 7C0 assert 2nd time at 1 data 15C8 assert word access at 2 1st time at 2 data 7C0 assert 2nd time at 3 data 15C8 assert longword access at 0 1st time at 0 data 7C0 assert 2nd time at 1 data 15C8 assert 3rd time at 2 data 23C16 assert 4th time at 3 data 31C24 assert
274 10.3.2 description of areas area 0: area 0 physical addresses a28Ca26 are 000. addresses a31Ca29 are ignored and the address range is h'00000000 + h'20000000 n C h'03ffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). ordinary memories such as sram, rom, and burst rom can be connected to this space. byte, word, or longword can be selected as the bus width using external pins md3 and md4. when the area 0 space is accessed, a cs0 signal is asserted. an rd signal that can be used as oe and the we0 C we3 signals for write control are also asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a0w2Ca0w0 bits of wcr2. when the burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2C10 according to the number of waits. area 1: area 1 physical addresses a28Ca26 are 001. addresses a31Ca29 are ignored and the address range is h'04000000 + h'20000000 n C h'07ffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). area 1 is the area specifically for the internal peripheral modules. the external memories cannot be connected. control registers of peripheral modules shown below are mapped to this area 1. their addresses are physical address, to which logical addresses can be mapped with the mmu enabled: dmac, port, irda, scif, adc, dac, intc (except intevt, ipra, iprb) those registers must be set not to be cached. area 2: area 2 physical addresses a28Ca26 are 010. addresses a31Ca29 are ignored and the address range is h'08000000 + h'20000000 n C h'0bffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). ordinary memories like sram and rom, as well as dram and synchronous dram, can be connected to this space. byte, word, or longword can be selected as the bus width using the a2sz1Ca2sz0 bits of bcr2 for ordinary memory. when dram is connected to area 2, the bus width is fixed at 16 bits. when the area 2 space is accessed, a cs2 signal is asserted. when ordinary memories are connected, an rd signal that can be used as oe and the we0 C we3 signals for write control are also asserted and the number of bus cycles is selected between 0 and 3 wait cycles using the a2w1 to a2w0 bits of wcr2. when synchronous dram is connected, the ras3u , ras3l signal, casu , casl signal, rd/ wr signal, and byte controls dqmhh, dqmhl, dqmlh, and dqmll are all asserted and addresses multiplexed. control of ras3u , ras3l , casu , casl , data timing, and address multiplexing is set with mcr.
275 when dram is connected, the ras2 signal, cas2h signal, cas2l signal, and rd/ wr signal are all asserted and addresses multiplexed. control of ras2 , cas , data timing, and address multiplexing is set with dcr. area 3: area 3 physical addresses a28Ca26 are 011. addresses a31Ca29 are ignored and the address range is h'0c000000 + h'20000000 n C h'0fffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). ordinary memories like sram and rom, as well as dram, and synchronous dram, can be connected to this space. byte, word or longword can be selected as the bus width using the a3sz1Ca3sz0 bits of bcr2 for ordinary memory. for dram, word or longword can be selected using the sz bit of mcr. when area 3 space is accessed, cs3 is asserted. when ordinary memories are connected, an rd signal that can be used as oe and the we0 C we3 signals for write control are asserted and the number of bus cycles is selected between 0 and 3 wait cycles using the a3w1 to a3w0 bits of wcr2. when synchronous dram is connected, the ras3u , ras3l signal, casu , casl signal, rd/ wr signal, and byte controls dqmhh, dqmhl, dqmlh, and dqmll are all asserted and addresses multiplexed. when dram is connected, the ras3u , ras3l signal, cashh signal, cashl signal, caslh signal, casll signal, and rd/ wr signal are all asserted and addresses multiplexed. for all of these, the ras signal, cashh signal, cashl signal, caslh signal, casll signal, and rd/ wr signal are all asserted and addresses multiplexed. control of ras , cas , and data timing and of address multiplexing is set with mcr. area 4: area 4 physical addresses a28Ca26 are 100. addresses a31Ca29 are ignored and the address range is h'10000000 + h'20000000 n C h'13ffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). only ordinary memories like sram and rom can be connected to this space. byte, word, or longword can be selected as the bus width using the a4sz1Ca4sz0 bits of bcr2. when the area 4 space is accessed, a cs4 signal is asserted. an rd signal that can be used as oe and the we0 C we3 signals for write control are also asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a4w2Ca4w0 bits of wcr2. area 5: area 5 physical addresses a28Ca26 are 101. addresses a31Ca29 are ignored and the address range is the 64 mbytes at h'14000000 + h'20000000 n C h'17ffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). ordinary memories like sram and rom as well as burst rom and pcmcia interfaces can be connected to this space. when the pcmcia interface is used, the ic memory card interface address range comprises the 32 mbytes at h'14000000 + h'20000000 x n to h'15ffffff + h'20000000 x n (where n = 06, and n = 16 represents shadow space), and the i/o card
276 interface address range comprises the 32 mbytes at h'16000000 + h'20000000 x n to h'17ffffff + h'20000000 x n (where n = 06, and n = 16 represents shadow space). for ordinary memory and burst rom, byte, word, or longword can be selected as the bus width using the a5sz1Ca5sz0 bits of bcr2. for the pcmcia interface, byte, and word can be selected as the bus width using the a5sz1Ca5sz0 bits of bcr2. when the area 5 space is accessed and ordinary memory is connected, a cs5 signal is asserted. an rd signal that can be used as oe and the we0 C we3 signals for write control are also asserted. when the pcmcia interface is used, the ce1a signal, ce2a signal, rd signal as oe signal, and we1 , iciord , iciowr signal are asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a5w2Ca5w0 bits of wcr2. with the pcmcia interface, from 0 to 38 wait cycles can be selected using the a5w2C a5w0 bits of wcr2 and the a5w3 bit of pcr. in addition, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when a burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2C11 (2C39 for the pcmcia interface) according to the number of waits. the setup and hold times of address/ cs5 for the read/write strobe signals can be set in the range 0.5C7.5 using a5ted2Ca5ted0 and a5teh2 to a5teh0 bits of the pcr register. area 6: area 6 physical addresses a28Ca26 are 110. addresses a31Ca29 are ignored and the address range is the 64 mbytes at h'18000000 + h'20000000 n C h'1bffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). ordinary memories like sram and rom as well as burst rom and pcmcia interfaces can be connected to this space. when the pcmcia interface is used, the ic memory card interface address range is 32 mbytes at h'18000000 + h'20000000 n C h'19ffffff + h'20000000 n and the i/o card interface address range is 32 mbytes at h'1a000000 + h'20000000 n C h'1bffffff + h'20000000 n (n = 0C6 and n = 1C6 are the shadow spaces). for ordinary memory and burst rom, byte, word, or longword can be selected as the bus width using the a6sz1Ca6sz0 bits of bcr2. for the pcmcia interface, byte, and word can be selected as the bus width using the a6sz1Ca6sz0 bits of bcr2. when the area 6 space is accessed and ordinary memory is connected, a cs6 signal is asserted. an rd signal that can be used as oe and the we0 C we3 signals for write control are also asserted. when the pcmcia interface is used, the ce1b signal, ce2b signal, rd signal as oe signal, and we , iciord , and iciowr signals are asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a6w2Ca6w0 bits of wcr2. with the pcmcia interface, from 0 to 38 wait cycles can be selected using the a6w2C a6w0 bits of wcr2 and the a6w3 bit of pcr. in addition, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). the bus cycle pitch of the burst cycle is determined within a range of 2C11 (2C39 for the pcmcia interface) according to the number of
277 waits. the setup and hold times of address/ cs6 for the read/write strobe signals can be set in the range 0.5C7.5 using a6ted2Ca6ted0 and a6teh2Ca6teh0 bits of the pcr register. 10.3.3 basic interface basic timing: the basic interface of the sh7709a uses strobe signal output in consideration of the fact that mainly static ram will be directly connected. figure 10.6 shows the basic timing of normal space accesses. a no-wait normal access is completed in two cycles. the bs signal is asserted for one cycle to indicate the start of a bus cycle. the csn signal is negated on the t2 clock falling edge to secure the negation period. therefore, in case of access at minimum pitch, there is a half-cycle negation period. there is no access size specification when reading. the correct access start address is output in the least significant bit of the address, but since there is no access size specification, 32 bits are always read in case of a 32-bit device, and 16 bits in case of a 16-bit device. when writing, only the we signal for the byte to be written is asserted. for details, see section 10.3.1, endian/access size and data alignment. read/write for cache fill or write-back follows the set bus width and transfers a total of 16 bytes continuously. the bus is not released during this transfer. for cache misses that occur during byte or word operand accesses or branching to odd word boundaries, the fill is always performed by longword accesses on the chip-external interface. write-through-area write access and non- cacheable read/write access are based on the actual address size.
278 t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 bs t2 read write figure 10.6 basic timing of basic interface
279 figures 10.7, 10.8, and 10.9 show examples of connection to 32, 16, and 8-bit data-width static ram, respectively. ???? ???? ???? ???? ???? a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? a18 a2 csn rd d31 d24 we3 d23 d16 we2 d15 d8 we1 d7 d0 we0 sh7709a 128k 8-bit sram ???? a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? ???? a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? ???? figure 10.7 example of 32-bit data-width static ram connection
280 a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? a17 a1 csn rd d15 d8 we1 d7 d0 we0 sh7709a 128k 8-bit sram ???? a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? ???? ???? ???? ???? figure 10.8 example of 16-bit data-width static ram connection
281 a16 a0 csn rd d7 d0 we0 sh7709a 128k 8-bit sram ???? a16 a0 cs oe i/o7 i/o0 we ???? ???? ???? ???? ???? ???? ???? figure 10.9 example of 8-bit data-width static ram connection
282 wait state control: wait state insertion on the basic interface can be controlled by the wcr2 settings. if the wcr2 wait specification bits corresponding to a particular area are not zero, a software wait is inserted in accordance with that specification. for details, see section 10.2.5, wait state control register 2 (wcr2). the specified number of tw cycles are inserted as wait cycles using the basic interface wait timing shown in figure 10.10. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 bs tw t2 read write figure 10.10 basic interface wait timing (software wait only)
283 when software wait insertion is specified by wcr2, the external wait input wait signal is also sampled. wait pin sampling is shown in figure 10.11. a 2-cycle wait is specified as a software wait. sampling is performed at the transition from the tw state to the t2 state; therefore, if the wait signal has no effect if asserted in the t1 cycle or the first tw cycle. when the waitsel bit in wcr1 is cleared to 0, the wait signal is sampled on the rising edge of the clock. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 wait tw tw tw t2 read write bs wait states inserted by wait signal figure 10.11 basic interface wait state timing (wait state insertion by wait signal waitsel = 0)
284 when the waitsel bit in the wcr1 register is set to 1, the wait signal is sampled at the falling edge of the clock. if the setup time and hold times with respect to the falling edge of the clock are not satisfied, the value sampled at the next falling edge is used. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 wait tw tw tw t2 read write bs wait states inserted by wait signal figure 10.12 basic interface wait state timing (wait state insertion by wait signal waitsel = 1)
285 10.3.4 dram interface dram connection method: when the memory type bits (dramtp2C0) in bcr1 are set to 100, area 3 becomes dram space; when set to 101, area 2 and area 3 become dram space. the dram interface function can then be used to connect the sh7709a directly to dram. 16 or 32 bits can be selected as the interface data width for area 3 when bits dramtp2C0 are set to 100, and 16 bits can be used for area 2 and 16 or 32 bits can be used for area 3 when bits dramtp2C0 are set to 101. 2-cas 16-bit drams can be connected, since cas is used to control byte access. signals used for connection when dram is connected to area 3 are ras3l , ras3u , cashh , cashl , caslh , casll , and rd/ wr . cashh and cashl are not used when the data width is 16 bits. when dram is connected to areas 2 and 3, the signals for dram connection in area 2 are ras2l , ras2u , cas2h , cas2l , and rd/ wr , and those for dram connection in area 3 are ras3l , ras3u , caslh , casll , and rd/ wr . in addition to normal read and write access modes, high-speed page mode is supported for burst access. also, for dram connected to area 3, edo mode, which enables the dram access time to be increased by delaying the data sampling timing by 1/2 clock when reading, is supported in addition to normal read and write access for burst mode.
286 a10 a2 ras rd/wr d31 d16 cashh cashl d15 d0 caslh casll sh7709a 256k 16-bit dram ???? a8 a0 ras oe we i/o15 i/o0 ucas lcas ???? ???? ???? a8 a0 ras oe we i/o15 i/o0 ucas lcas ???? ???? ???? ???? ???? ???? ???? ???? figure 10.13 example of dram connection (32-bit data width)
287 a9 a1 ras3l or ras3u ras2l or ras2u rd/wr d15 d0 caslh casll cas2h cas2l sh7709a 256k 16-bit dram ???? a8 a0 ras oe we i/o15 i/o0 ucas lcas ???? ???? ???? a8 a0 ras oe we i/o15 i/o0 ucas lcas ???? ???? ???? ???? ???? ???? ???? ???? figure 10.14 example of dram connection (16-bit data width)
288 address multiplexing: when area 2 and area 3 are designated as dram space, address multiplexing is always performed in accesses to dram. this enables dram, which requires row and column address multiplexing, to be connected directly to the sh7709a without using an external address multiplexer. any of the four multiplexing methods shown below can be selected, by setting bits amx1-0 in mcr for area 3 dram, or bits amx1-0 in dcr for area 2 dram. the relationship between bits amx1-0 and address multiplexing is shown in table 10.13. the address output pins subject to address multiplexing are a15 to a1. pins a25 to a16 carry the original address. table 10.13 relationship between amx1-0 and address multiplexing setting number of column external address pins amx1 amx0 address bits output timing a1 to a14 a15 0 0 8 bits column address a1 to a14 a15 row address a9 to a22 a23 0 1 9 bits column address a1 to a14 a15 row address a10 to a23 a24 1 0 10 bits column address a1 to a14 a15 row address a11 to a24 a25 1 1 11 bits column address a1 to a14 a15 row address a12 to a25 a15
289 basic timing: the basic timing for dram access is 3 cycles (rcd (1C0) = 00, anw (1C0) = 00). this basic timing is shown in figure 10.15. tpc is the precharge cycle, tr the ras assert cycle, tc1 the cas assert cycle, and tc2 the read data latch cycle. ckio rd/wr d31 to d0 (read) d31 to d0 (write) rasxx casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr tc1 tc2 (tpc) figure 10.15 basic timing for dram access
290 wait state control: as the clock frequency increases, it becomes impossible to complete all states in one cycle as in basic access. therefore, provision is made for state extension by using the setting bits in wcr2, mcr, dcr, and bcr3. the timing with state extension using these settings is shown in figure 10.16. additional tpc cycles (cycles used to secure the ras precharge time) can be inserted by means of the tpc bits in mcr and dcr, giving from 1 to 4 cycles. the number of cycles from ras assertion to cas assertion can be set to between 1 and 4 by inserting trw cycles by means of the rcd bits in mcr and dcr. and the number of cycles from cas assertion to the end of the access can be varied between 1 and 3 according to the setting of a2w (1C0) or a3w (1C0) in wcr2.
291 ckio rd/wr d31 to d0 (read) d31 to d0 (write) rasxx casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr trw trw tc1 tcw tc2 (tpc) (tpc) row address row address column address figure 10.16 dram wait state timing
292 short pitch access: the bus state controller of the sh7709a can perform short-pitch access to dram as shown in figure 10.17, when extend bit is set to 1. tcs is a cas assert and data access state. tr ckio a25 to a16 a15 to a0 rd/wr rasxx casxx d31 to d0 (read) d31 to d0 (write) cs2 or cs3 bs tcs (tpc) row address row address column address figure 10.17 dram short-pitch access timing
293 burst access: in addition to the normal dram access mode in which a row address is output in each data access, a high-speed page mode is also provided for the case where consecutive accesses are made to the same row. this mode allows fast access to data by outputting the row address only once, then changing only the column address for each subsequent access. normal access or burst access using high-speed page mode can be selected by means of the burst enable (be) bit in mcr and dcr. the timing for burst access using high-speed page mode is shown in figure 10.18. in burst transfer, 4 (longword access) or 16 (cache fill or cache write-back) bytes of data are burst- transferred in case of a 16-bit bus size. with a 32-bit bus size, 16 bytes of data are burst- transferred (cache fill or cache write-back). in a 16-byte burst transfer (cache fill), the first access comprises a longword that includes the data requiring access. the remaining accesses are performed on 16-byte boundary data that includes the relevant data. in burst transfer (cache write- back), sequential writing is performed from first-to-last order for 16-byte boundary data.
294 ckio rd/wr d31 to d0 (read) d31 to d0 (write) rasxx casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr tc2 (tpc) tc1 tc2 tc1 tc2 tc1 tc2 tc1 row address row address column address column address column address column address figure 10.18 dram burst access timing
295 short-pitch burst access: the bus state controller of the sh7709a can perform short-pitch burst access to dram as shown in figure 10.19, when extend bit and be are set to 1 and 1, respectively. tcs is a cas assert and data access state. tr tcs tcs tcs tcs (tpc) ckio rd/wr d31 to d0 (read) d31 to d0 (write) rasxx casxx bs cs2 or cs3 a25 to a16 a15 to a0 row address column address column address column address row address column address figure 10.19 dram short-pitch burst access timing edo mode: with dram, in addition to the mode in which data is output to the data bus only while the cas signal is asserted in a data read cycle, an edo (extended data out) mode is also provided in which, once the cas signal is asserted while the ras signal is asserted, even if the cas signal is negated, data is output to the data bus until the cas signal is next asserted. in the sh7709a, the edo mode bit (edomode) in mcr enables selection, for dram in area 3 only, of either normal access/burst access using high-speed page mode or edo mode normal access/burst access. edo mode normal access is shown in figure 10.20, and burst access in figure 10.21.
296 in edo mode, the timing for data output to the data bus in a read cycle is extended as far as the next assertion of the cas signal, so that the data latch timing is delayed by 1/2 cycle and made the rising edge of the ckio clock, enabling the dram access time to be increased. tr tc1 tc2 (tpc) ckio a25 to a16 a15 to a0 rd/wr ras3x casxx d31 to d0 (read) d31 to d0 (write) bs cs3 row address column address row address figure 10.20 normal access timing in dram edo mode
297 ckio rd/wr d31 to d0 (read) d31 to d0 (write) ras3x casxx bs cs3 a25 to a16 a15 to a0 tr tc2 (tpc) tc1 tc2 tc1 tc2 tc1 tc2 tc1 row address column address column address column address column address row address figure 10.21 burst access timing in dram edo mode
298 refresh timing: the bus state controller includes a function for controlling dram refreshing. distributed refreshing using a cas-before-ras cycle can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in mcr for dram in area 3, or by clearing the rmode bit to 0 and setting the rfsh bit to 1 in dcr for dram in area 2. when cas-before-ras refresh cycles are executed, refreshing is performed at intervals determined by the input clock selected by bits cks2-0 in rtcsr, and the value set in rtcor. the value of bits cks2-0 in rtcor should be set so as to satisfy the stipulation for the dram refresh interval. first make the settings for rtcor, rtcnt, and the rmode and rfsh bits in mcr, then make the cks2-cks0 setting. when the clock is selected by cks2-cks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and the irqout pin goes low. if the sh7709as external bus can be used, cas-before-ras refreshing is performed, and if there is no other interrupt request the irqout pin goes high. at the same time, rtcnt is cleared to zero and the count-up is restarted. figure 10.22 shows the operation of cas- before-ras refreshing. rtcor value rtcnt h'00000000 rtcsr.cks(2C0) cmf external bus cmf flag cleared by start of refresh cycle = 000 000 rtcnt cleared to 0 when rtcnt = rtcor cas-before-ras refresh cycle time figure 10.22 cas-before-ras refresh operation
299 figure 10.23 shows the timing of the cas-before-ras refresh cycle. the number of ras assert cycles in the refresh cycle is specified by the tras bits in mcr and dcr. the specification of the ras precharge time in the refresh cycle is determined by the setting of the tpc bits in mcr and dcr in the same way as for normal access. trc trr1 trr2 (tpc) ckio rd/ wr rasxx casxx cs2 or cs3 (high) figure 10.23 dram cas-before-ras refresh cycle timing the self-refreshing supported by the sh7709a is shown in figure 10.24. after the self-refresh is cleared, the refresh controller immediately generates a refresh request. the ras precharge time immediately after the end of the self-refreshing can be set by the tpc bits in mcr and dcr. drams include low-power products (l versions) with a long refresh cycle time (for example, the l version of the hm51w4160al has a refresh cycle of 1024 cycles/128 ms compared with 1024 cycles/16 ms for the normal version). with these drams, however, the same refresh cycle as for the normal version is requested only in case of refreshing immediately following self-refreshing. to ensure efficient dram refreshing, therefore, processing is needed to generate an overflow interrupt and restore the refresh cycle to the proper value, after the necessary cas-before-ras refreshing has been performed following self-refreshing of an l-version dram, using rfcr and the ovf, ovie, and lmts bits in rtcsr. the necessary procedure is as follows.
300 1. normally, set the refresh counter count value to the optimum value for the l version (e.g. 1024 cycles/128 ms). 2. when a transition is made to self-refreshing: a. provide an interrupt handler to restore the refresh counter count value to the optimum value for the l version (e.g. 1024 cycles/128 ms) when a refresh counter overflow interrupt is generated. b. reset the refresh counter count value to the requested short cycle (e.g. 1024 cycles/16 ms), set refresh controller overflow interruption, and clear the refresh count register (rfcr) to 0. c. set self-refresh mode. by using this procedure, the refreshing immediately following a self-refresh will be performed in a short cycle, and when adequate refreshing ends, an interrupt is generated and the setting can be restored to the original refresh cycle. cas-before-ras refreshing is performed in normal operation, in sleep mode, and in case of a manual reset. self-refreshing is performed in normal operation, in sleep mode, in standby mode, and in case of a manual reset. when the bus has been released in response to a bus arbitration request, or when a transition is made to standby mode, signals generally become high-impedance, but whether the ras and cas signals become high-impedance or continue to be output can be controlled by the hizcnt bit in bcr1. this enables the dram to be kept in the self-refreshing state.
301 trc trr1 trrw tsr1 tsr1 tsr2 (tpc) ckio rd/wr rasxx casxx cs2 or cs3 (tpc) (high) figure 10.24 dram self-refresh cycle timing power-on sequence: regarding use of dram after powering on, it is requested that a wait time (at least 100 s or 200 s) during which no access can be performed be provided, followed by the prescribed number (usually 8) or more dummy cas-before-ras refresh cycles. as the bus state controller does not perform any special operations for a power-on reset, the necessary power-on sequence must be carried out by the initialization program executed after a power-on reset.
302 10.3.5 synchronous dram interface synchronous dram direct connection: since synchronous dram can be selected by the cs signal, physical space areas 2 and 3 can be connected using ras and other control signals in common. if the memory type bits (dramtp2C0) in bcr1 are set to 010, area 2 is ordinary memory space and area 3 is synchronous dram space; if set to 011, areas 2 and 3 are both synchronous dram space. with the sh7709a, burst length 1 burst read/single write mode is supported as the synchronous dram operating mode. a data bus width of 16 or 32 bits can be selected. the burst enable bit (be) in mcr is ignored, a 16-bit burst transfer is performed in a cache fill/write-back cycle, and only one access is performed in a write-through area write or a non-cacheable area read/write. the control signals for direct connection of synchronous dram are ras3l , ras3u , casl , casu , rd/ wr , cs2 or cs3 , dqmuu, dqmul, dqmlu, dqmll, and cke. all the signals other than cs2 and cs3 are common to all areas, and signals other than cke are valid and fetched to the synchronous dram only when cs2 or cs3 is asserted. synchronous dram can therefore be connected in parallel to a number of areas. cke is negated (low) only when self-refreshing is performed, and is always asserted (high) at other times. however, which of the ras3l , ras3u , casl , and casu signals are output is determined by whether the address is in the upper or lower 32 mbytes in each area. when the address is in upper 32 mbytes (area 2: h'0a000000 to h'0bffffff, area 3: h'0e000000 to h'0fffffff), ras3u and casu are output; when in lower 32 mbytes (area 2: h'08000000 to h'09ffffff, area 3: h'0c000000 to h'0dffffff), ras3l and casl are output. in the refresh cycle and mode- register write cycle, ras3u and ras3l or casu and casl are output. commands for synchronous dram are specified by ras3l , ras3u , casl , casu , rd/ wr , and special address signals. the commands are nop, auto-refresh (ref), self-refresh (self), precharge all banks (pall), row address strobe bank active (actv), read (read), read with precharge (reada), write (writ), write with precharge (writa), and mode register write (mrs). byte specification is performed by dqmuu, dqmul, dqmlu, and dqmll. a read/write is performed for the byte for which the corresponding dqm is low. in big-endian mode, dqmuu specifies an access to address 4n, and dqmll specifies an access to address 4n + 3. in little- endian mode, dqmuu specifies an access to address 4n + 3, and dqmll specifies an access to address 4n. figures 10.25 and 10.26 show examples of the connection of two 1m 16-bit 4-bank synchronous drams and one 1m 16-bit 4-bank synchronous dram, respectively.
303 a15 a14 a13 a2 ckio cke csn ras3x casx rd/ wr d31 d16 dqmuu dqmul d15 d0 dqmlu dqmll sh7709a 64m synchronous dram ( 1m 16-bit 4-bank ) a13 a12 a11 a0 clk cke cs ras cas we dq15 dq0 dqmu dqml a13 a12 a11 a0 clk cke cs ras cas we dq15 dq0 dqmu dqml ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? note : "x" is u or l figure 10.25 example of 64-mbit synchronous dram connection (32-bit bus width)
304 sh7709a 64m synchronous dram 1m 16-bit 4-bank a14 a13 a12 a1 ckio cke csn ras3x casx rd/ wr d15 d0 dqmlu dqmll a13 a12 a11 a0 clk cke cs ras cas we dq15 dq0 dqmu dqml ??? ??? ??? ??? ??? ??? ??? ??? figure 10.26 example of 64-mbit synchronous dram (16-bit bus width) address multiplexing: synchronous dram can be connected without external multiplexing circuitry in accordance with the address multiplex specification bits amx2-amx0 in mcr. table 10.14 shows the relationship between the address multiplex specification bits and the bits output at the address pins. a25Ca16 and a0 are not multiplexed; the original values are always output at these pins. when a0, the lsb of the synchronous dram address, is connected to the sh7709a, it performs longword address specification. connection should therefore be made in the following order: with a 32-bit bus width, connect pin a0 of the synchronous dram to pin a2 of the sh7709a, then connect pin a1 to pin a3; with a 16-bit bus width, connect pin a0 of the synchronous dram to pin a1 of the sh7709a, then connect pin a1 to pin a2.
305 table 10.14 relationship between bus width, amx, and address multiplex output setting external address pins bus width amx2 amx1 amx0 output timing a1 to a8 a9 a10 a11 a12 a13 a14 a15 32 bits 1 0 0 column address a1 to a8 a9 a10 a11 l/h * 1 a13 a22 * 2 a23 * 2 row address a9 to a16 a17 a18 a19 a20 a21 a22 * 2 a23 * 2 1 column address a1 to a8 a9 a10 a11 l/h * 1 a13 a23 * 2 a24 * 2 row address a10 to a17 a18 a19 a20 a21 a22 a23 * 2 a24 * 2 1 1 column address a1 to a8 a9 a11 a11 l/h * 1 a21 * 2 a22 * 2 a15 row address a9 to a16 a17 a18 a19 a20 a21 * 2 a22 * 2 a23 0 0 0 column address a1 to a8 a9 a10 a11 l/h * 1 a21 * 2 a14 a15 row address a9 to a16 a17 a18 a19 a20 a21 * 2 a22 a23 1 column address a1 to a8 a9 a10 a11 l/h * 1 a22 * 2 a14 a15 row address a10 to a17 a18 a19 a20 a21 a22 * 2 a23 a24 1 0 column address a1 to a8 a9 a11 a11 l/h * 1 a23 * 2 a14 a15 row address a11 to a18 a19 a20 a21 a22 a23 * 2 a24 a25 1 column address a1 to a8 a9 l/h * 1 a19 * 2 a12 a13 a14 a15 row address a9 to a16 a17 a18 a19 * 2 a20 a21 a22 a23 notes: * 1 l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. * 2 bank address specification
306 table 10.14 relationship between bus width, amx, and address multiplex output (cont) setting external address pins bus width amx2 amx1 amx0 output timing a1 to a8 a9 a10 a11 a12 a13 a14 a15 16 bits 1 0 0 column address a1 to a8 a9 a10 l/h * 1 a12 a21 * 2 a22 * 2 a15 row address a9 to a16 a17 a18 a19 a20 a21 * 2 a22 * 2 a23 1 column address a1 to a8 a9 a10 l/h * 1 a12 a22 * 2 a23 * 2 a15 row address a10 to a17 a18 a19 a20 a21 a22 * 2 a23 * 2 a24 1 0 column address a1 to a8 a9 a10 l/h * 1 a12 a23 * 2 a24 * 2 a15 row address a11 to a18 a19 a20 a21 a22 a23 * 2 a24 * 2 a25 0 0 0 column address a1 to a8 a9 a10 l/h * 1 a20 * 2 a13 a14 a15 row address a9 to a16 a17 a18 a19 a20 * 2 a21 a22 a23 1 column address a1 to a8 a9 a10 l/h * 1 a21 * 2 a13 a14 a15 row address a10 to a17 a18 a19 a20 a21 * 2 a22 a23 a24 1 0 column address a1 to a8 a9 a10 l/h * 1 a22 * 2 a13 a14 a15 row address a11 to a18 a19 a20 a21 a22 * 2 a23 a24 a25 1 column address a1 to a8 l/h * 1 a18 * 2 a11 a12 a13 a14 a15 row address a9 to a16 a17 a18 * 2 a19 a20 a21 a22 a23 notes: * 1 l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. * 2 bank address specification
307 table 10.15 example of correspondence between sh7709a and synchronous dram address pins (amx (2-0) = 011 (32-bit bus width)) sh7709a address pin synchronous dram address pin ras cycle cas cycle function a11 a19 a19 a9 bank select bank address a10 a18 l/h a8 address precharge setting a9 a17 a9 a7 address a8 a16 a8 a6 a7 a15 a7 a5 a6 a14 a6 a4 a5 a13 a5 a3 a4 a12 a4 a2 a3 a11 a3 a1 a2 a10 a2 a0 a1 a9 a1 not used a0 a0 a0 not used burst read: in the example in figure 10.27 it is assumed that four 2m 8-bit synchronous drams are connected and a 32-bit data width is used, and the burst length is 1. following the tr cycle in which actv command output is performed, a read command is issued in the tc1, tc2, and tc3 cycles, and a reada command in the tc4 cycle, and the read data is accepted on the rising edge of the external command clock (ckio) from cycle td1 to cycle td4. the tpc cycle is used to wait for completion of auto-precharge based on the reada command inside the synchronous dram; no new access command can be issued to the same bank during this cycle, but access to synchronous dram for another area is possible. in the sh7709a, the number of tpc cycles is determined by the tpc bit specification in mcr, and commands cannot be issued for the same synchronous dram during this interval. the example in figure 10.26 shows the basic timing. to connect low-speed synchronous dram, the cycle can be extended by setting wcr2 and mcr bits. the number of cycles from the actv command output cycle, tr, to the read command output cycle, tc1, can be specified by the rcd bit in mcr, with a values of 0 to 3 specifying 1 to 4 cycles, respectively. in case of 2 or more cycles, a trw cycle, in which an nop command is issued for the synchronous dram, is inserted between the tr cycle and the tc cycle. the number of cycles from read and reada command output cycles tc1-tc4 to the first read data latch cycle, td1, can be specified as 1 to 3 cycles independently for areas 2 and 3 by means of a2w1 and a2w0 or a3w1 and a3w0 in wcr2. this number of cycles corresponds to the number of synchronous dram cas latency cycles.
308 ckio a25 to a16, a13 a12 a15, a14, a11 to a0 cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 tpc figure 10.27 basic timing for synchronous dram burst read
309 figure 10.28 shows the burst read timing when rcd is set to 1, a3w1 and a3w0 are set to 10, and tpc is set to 1. the bs cycle, which is asserted for one cycle at the start of a bus cycle for normal access space, is asserted in each of cycles td1Ctd4 in a synchronous dram cycle. when a burst read is performed, the address is updated each time cas is asserted. as the unit of burst transfer is 16 bytes, address updating is performed for a3 and a2 only (a3, a2, and a1 for a 16-bit bus width). the order of access is as follows: in a fill operation in the event of a cache miss, the missed data is read first, then 16-byte boundary data including the missed data is read in wraparound mode. ckio a25 to a16, a13 a12 a15, a14, a11 to a0 cs2 or cs3 ras3x casx rd/wr dqmxx d31 to d0 bs tr tc1 tc2 tc3/td1 tc4/td2 td3 tpc trw td4 figure 10.28 synchronous dram burst read wait specification timing
310 single read: figure 10.29 shows the timing when a single address read is performed. as the burst length is set to 1 in synchronous dram burst read/single write mode, only the required data is output. consequently, no unnecessary bus cycles are generated even when a cache-through area is accessed. ckio a25 to a16, a13 a12 a15, a14, a11 to a0 cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tr tc1 td1 tpc figure 10.29 basic timing for synchronous dram single read
311 burst write: the timing chart for a burst write is shown in figure 10.30. in the sh7709a, a burst write occurs only in the event of cache write-back or 16-byte transfer by dmac. in a burst write operation, following the tr cycle in which actv command output is performed, a writ command is issued in the tc1, tc2, and tc3 cycles, and a writa command that performs auto- precharge is issued in the tc4 cycle. in the write cycle, the write data is output at the same time as the write command. in case of the write with auto-precharge command, precharging of the relevant bank is performed in the synchronous dram after completion of the write command, and therefore no command can be issued for the same bank until precharging is completed. consequently, in addition to the precharge wait cycle, tpc, used in a read access, cycle trwl is also added as a wait interval until precharging is started following the write command. issuance of a new command for the same bank is postponed during this interval. the number of trwl cycles can be specified by the trwl bit in mcr.
312 ckio csn rd/ wr ras3x casx dqmxx d31 to d0 (read) bs tr tc1 tc2 tc3 tc4 (tpc) (tpc) address upper bits a12, a11, a10 or a9 address lower bits figure 10.30 basic timing for synchronous dram burst write
313 single write: the basic timing chart for write access is shown in figure 10.31. in a single write operation, following the tr cycle in which actv command output is performed, a writa command that performs auto-precharge is issued in the tc1 cycle. in the write cycle, the write data is output at the same time as the write command. in case of the write with auto-precharge command, precharging of the relevant bank is performed in the synchronous dram after completion of the write command, and therefore no command can be issued for the same bank until precharging is completed. consequently, in addition to the precharge wait cycle, tpc, used in a read access, cycle trwl is also added as a wait interval until precharging is started following the write command. issuance of a new command for the same bank is postponed during this interval. the number of trwl cycles can be specified by the trwl bit in mcr.
314 ckio csn rd/ wr ras3x casx dqmxx d31 to d0 bs address upper bits a12 or a10 address lower bits cke tr tc1 (trwl) (tpc) figure 10.31 basic timing for synchronous dram single write
315 bank active: the synchronous dram bank function is used to support high-speed accesses to the same row address. when the rasd bit in mcr is 1, read/write command accesses are performed using commands without auto-precharge (read, writ). in this case, precharging is not performed when the access ends. when accessing the same row address in the same bank, it is possible to issue the read or writ command immediately, without issuing an actv command, in the same way as in the ras down state in dram fast page mode. as synchronous dram is internally divided into two or four banks, it is possible to activate one row address in each bank. if the next access is to a different row address, a pre command is first issued to precharge the relevant bank, then when precharging is completed, the access is performed by issuing an actv command followed by a read or writ command. if this is followed by an access to a different row address, the access time will be longer because of the precharging performed after the access request is issued. in a write, when auto-precharge is performed, a command cannot be issued for a period of trwl + tpc cycles after issuance of the writa command. when bank active mode is used, read or writ commands can be issued successively if the row address is the same. the number of cycles can thus be reduced by trwl + tpc cycles for each write. the number of cycles between issuance of the precharge command and the row address strobe command is determined by the tpc bit in mcr. whether faster execution speed is achieved by use of bank active mode or by use of basic access is determined by the probability of accessing the same row address (p1), and the average number of cycles from completion of one access to the next access (ta). if ta is greater than tpc, the delay due to the precharge wait when writing is imperceptible. in this case, the access speed for bank active mode and basic access is determined by the number of cycles from the start of access to issuance of the read/write command: (tpc + trcd) (1 C p1) and trcd, respectively. there is a limit on tras, the time for placing each bank in the active state. if there is no guarantee that there will not be a cache hit and another row address will be accessed within the period in which this value is maintained by program execution, it is necessary to set auto-refresh and set the refresh cycle to no more than the maximum value of tras. in this way, it is possible to observe the restrictions on the maximum active state time for each bank. if auto-refresh is not used, measures must be taken in the program to ensure that the banks do not remain active for longer than the prescribed time. a burst read cycle without auto-precharge is shown in figure 10.32, a burst read cycle for the same row address in figure 10.33, and a burst read cycle for different row addresses in figure 10.34. similarly, a burst write cycle without auto-precharge is shown in figure 10.35, a burst write cycle for the same row address in figure 10.36, and a burst write cycle for different row addresses in figure 10.37.
316 a tnop cycle, in which no operation is performed, is inserted before the tc cycle in which the read command is issued in figure 10.33, but when synchronous dram is read, there is a two- cycle latency for the dqmxx signal that performs the byte specification. if the tc cycle were performed immediately, without inserting a tnop cycle, it would not be possible to perform the dqmxx signal specification for td1 cycle data output. this is the reason for inserting the tnop cycle. if the cas latency is two cycles or longer, tnop cycle insertion is not performed, since the timing requirements will be met even if the dqmxx signal is set after the tc cycle. when bank active mode is set, if only accesses to the respective banks in the area 3 space are considered, as long as accesses to the same row address continue, the operation starts with the cycle in figure 10.32 or 10.35, followed by repetition of the cycle in figure 10.33 or 10.36. an access to a different area 3 space during this time has no effect. if there is an access to a different row address in the bank active state, after this is detected the bus cycle in figure 10.34 or 10.37 is executed instead of that in figure 10.33 or 10.36. in bank active mode, too, all banks become inactive after a refresh cycle or after the bus is released as the result of bus arbitration.
317 ckio a25 to a16, a13 (a25 to a16, a11) a12 (a10) a15, a14, a11 to a0 (a15 to a12, a9 to a0) cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 figure 10.32 burst read timing (no precharge)
318 ckio a25 to a16, a13 (a25 to a16, a11) a12 (a10) a15, a14, a11 to a0 (a15 to a12, a9 to a0) cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tnop tc1 tc2/td1 tc3/td2 tc4/td3 td4 figure 10.33 burst read timing (same row address)
319 ckio a25 to a16, a13 (a25 to a16, a11) a12 (a10) a15, a14, a11 to a0 (a15 to a12, a9 to a0) cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tp tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 figure 10.34 burst read timing (different row addresses)
320 ckio a25 to a16, a13 (a25 to a16, a11) a12 (a10) a15, a14, a11 to a0 (a15 to a12, a9 to a0) cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tr tc1 tc2 tc3 tc4 figure 10.35 burst write timing (no precharge)
321 ckio a25 to a16, a13 (a25 to a16, a11) a12 (a10) a15, a14, a11 to a0 (a15 to a12, a9 to a0) cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tc1 tc2 tc3 tc4 figure 10.36 burst write timing (same row address)
322 ckio a25 to a16, a13 (a25 to a16, a11) a12 (a10) a15, a14, a11 to a0 (a15 to a12, a9 to a0) cs2 or cs3 ras3x casx rd/ wr dqmxx d31 to d0 bs tp tr tc1 tc2 tc3 td4 figure 10.37 burst write timing (different row addresses)
323 refreshing: the bus state controller is provided with a function for controlling synchronous dram refreshing. auto-refreshing can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in mcr. if synchronous dram is not accessed for a long period, self-refresh mode, in which the power consumption for data retention is low, can be activated by setting both the rmode bit and the rfsh bit to 1. ? auto-refreshing refreshing is performed at intervals determined by the input clock selected by bits cks2-0 in rtcsr, and the value set in rtcor. the value of bits cks2-0 in rtcor should be set so as to satisfy the refresh interval stipulation for the synchronous dram used. first make the settings for rtcor, rtcnt, and the rmode and rfsh bits in mcr, then make the cks2- cks0 setting. when the clock is selected by cks2-cks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and an auto-refresh is performed. at the same time, rtcnt is cleared to zero and the count-up is restarted. figure 10.38 shows the auto-refresh cycle timing. all-bank precharging is performed in the tp cycle, then an ref command is issued in the trr cycle following the interval specified by the tpc bits in mcr. after the trr cycle, new command output cannot be performed for the duration of the number of cycles specified by the tras bits in mcr plus the number of cycles specified by the tpc bits in mcr. the tras and tpc bits must be set so as to satisfy the synchronous dram refresh cycle time stipulation (active/active command delay time). auto-refreshing is performed in normal operation, in sleep mode, and in case of a manual reset.
324 rtcor value rtcnt h'00000000 rtcsr.cks(2C0) cmf external bus cmf flag cleared by start of refresh cycle = 000 000 rtcnt cleared to 0 when rtcnt = rtcor auto-refresh cycle time figure 10.38 auto-refresh operation
325 tp trr trrw trrw (tpc) ckio cke csn ras3u , ras3l casu , casl rd/ wr figure 10.39 synchronous dram auto-refresh timing
326 ? self-refreshing self-refresh mode is a kind of standby mode in which the refresh timing and refresh addresses are generated within the synchronous dram. self-refreshing is activated by setting both the rmode bit and the rfsh bit to 1. the self-refresh state is maintained while the cke signal is low. synchronous dram cannot be accessed while in the self-refresh state. self-refresh mode is cleared by clearing the rmode bit to 0. after self-refresh mode has been cleared, command issuance is disabled for the number of cycles specified by the tpc bits in mcr. self-refresh timing is shown in figure 10.40. settings must be made so that self-refresh clearing and data retention are performed correctly, and auto-refreshing is performed at the correct intervals. when self-refreshing is activated from the state in which auto-refreshing is set, or when exiting standby mode other than through a power-on reset, auto-refreshing is restarted if rfsh is set to 1 and rmode is cleared to 0 when self-refresh mode is cleared. if the transition from clearing of self-refresh mode to the start of auto-refreshing takes time, this time should be taken into consideration when setting the initial value of rtcnt. making the rtcnt value 1 less than the rtcor value will enable refreshing to be started immediately. after self-refreshing has been set, the self-refresh state continues even if the chip standby state is entered using the sh7709as standby function, and is maintained even after recovery from standby mode other than through a power-on reset. in case of a power-on reset, the bus state controllers registers are initialized, and therefore the self-refresh state is cleared. self-refreshing is performed in normal operation, in sleep mode, in standby mode, and in case of a manual reset. when using synchronous dram, use the following procedure to initiate self-refreshing. 1. clear the refresh control bit to 0. 2. write h'00 to the rtcnt register. 3. set the refresh control bit and refresh mode bit to 1.
327 trs1 ckio rd/wr csn ras3u, ras3l casu, casl cke (trs2) (trs2) trs3 (tpc) (tpc) tp figure 10.40 synchronous dram self-refresh timing ? relationship between refresh requests and bus cycle requests if a refresh request is generated during execution of a bus cycle, execution of the refresh is deferred until the bus cycle is completed. if a refresh request occurs when the bus has been released by the bus arbiter, refresh execution is deferred until the bus is acquired. if a match between rtcnt and rtcor occurs while a refresh is waiting to be executed, so that a new refresh request is generated, the previous refresh request is eliminated. in order for refreshing to be performed normally, care must be taken to ensure that no bus cycle or bus mastership occurs that is longer than the refresh interval. when a refresh request is generated, the irqout pin is asserted (driven low). therefore, normal refreshing can be performed by having the irqout pin monitored by a bus master other than the sh7709a requesting the bus, or the bus arbiter, and returning the bus to the sh7709a. when refreshing is started, and if no other interrupt request has been generated, the irqout pin is negated (driven high).
328 power-on sequence: in order to use synchronous dram, mode setting must first be performed after powering on. to perform synchronous dram initialization correctly, the bus state controller registers must first be set, followed by a write to the synchronous dram mode register. in synchronous dram mode register setting, the address signal value at that time is latched by a combination of the ras , cas , and rd/ wr signals. if the value to be set is x, the bus state controller provides for value x to be written to the synchronous dram mode register by performing a write to address h'ffffd000 + x for area 2 synchronous dram, and to address h'ffffe000 + x for area 3 synchronous dram. in this operation the data is ignored, but the mode write is performed as a byte-size access. to set burst read/single write, cas latency 1 to 3, wrap type = sequential, and burst length 1 supported by the sh7709a, arbitrary data is written in a byte-size access to the following addresses. area 2 area 3 32-bit cas latency 1 ffffd840 ffffe840 bus width cas latency 2 ffffd880 ffffe880 cas latency 3 ffffd8c0 ffffe8c0 area 2 area 3 16-bit cas latency 1 ffffd420 ffffe420 bus width cas latency 2 ffffd440 ffffe440 cas latency 3 ffffd460 ffffe460 mode register setting timing is shown in figure 10.41. as a result of the write to address h'ffffd000 + x or h'ffffe000 + x, a precharge all banks (pall) command is first issued in the trp1 cycle, then a mode register write command is issued in the tmw1 cycle. address signals, when the mode-register write command is issued, are as follows: 32-bit a15-a9 0000100 (burst read and single write) bus width a8-a6 cas latency a5 0 (burst type = sequential) a4-a2 000 (burst length 1) 16-bit a14-a8 0000100 (burst read and single write) bus width a7-a5 cas latency a4 0 (burst type = sequential) a3-a1 000 (burst length 1) before mode register setting, a 100 s idle time (depending on the memory manufacturer) must be guaranteed after powering on requested by the synchronous dram. if the reset signal pulse width is greater than this idle time, there is no problem in performing mode register setting immediately. the number of dummy auto-refresh cycles specified by the manufacturer (usually 8) or more must be executed. this is usually achieved automatically while various kinds of initialization are being
329 performed after auto-refresh setting, but a way of carrying this out more dependably is to set a short refresh request generation interval just while these dummy cycles are being executed. with simple read or write access, the address counter in the synchronous dram used for auto- refreshing is not initialized, and so the cycle must always be an auto-refresh cycle. ckio a11 a12 or a10 a9 to a2 csn rd/wr ras3u or ras3l casu or casl d31 to d0 cke trp1 trp2 trp3 trp4 tmw1 tmw2 tmw3 tmw4 (high) a15 to a13 or a15 to a12 figure 10.41 synchronous dram mode write timing
330 10.3.6 burst rom interface setting bits a0bst (1C0), a5bst (1C0), and a6bst (1C0) in bcr1 to a non-zero value allows burst rom to be connected to areas 0, 5, and 6. the burst rom interface provides high-speed access to rom that has a nibble access function. the timing for nibble access to burst rom is shown in figure 10.42. two wait cycles are set. basically, access is performed in the same way as for normal space, but when the first cycle ends the cs0 signal is not negated, and only the address is changed before the next access is executed. when 8-bit rom is connected, the number of consecutive accesses can be set as 4, 8, or 16 by bits a0bst (1C0), a5bst (1C0), or a6bst (1C 0). when 16-bit rom is connected, 4 or 8 can be set in the same way. when 32-bit rom is connected, only 4 can be set. wait pin sampling is performed in the first access if one or more wait states are set, and is always performed in the second and subsequent accesses. the second and subsequent access cycles also comprise two cycles when a burst rom setting is made and the wait specification is 0. the timing in this case is shown in figure 10.43.
331 t1 tw tw tb2 tb1 tw tb2 ckio a25 to a4 a3 to a0 csn rd/we rd d31 to d0 bs wait t2 note: for a write cycle, a basic bus cycle (write cycle) is performed. tb1 figure 10.42 burst rom wait access timing
332 t1 tb2 tb1 tb2 tb1 tb2 tb1 t2 ckio a25 to a4 a3 to a0 csn rd/wr rd d31 to d0 bs wait note: for a write cycle, a basic bus cycle (write cycle) is performed. figure 10.43 burst rom basic access timing
333 10.3.7 pcmcia interface in the sh7709a, setting the a5pcm bit in bcr1 to 1 makes the bus interface for physical space area 5 an ic memory card and i/o card interface as stipulated in jeida version 4.2 (pcmcia2.1). setting the a6pcm bit to 1 makes the bus interface for physical space area 6 an ic memory card and i/o card interface as stipulated in jeida version 4.2. when the pcmcia interface is used, a bus size of 8 or 16 bits can be set by bits a5sz1 and a5sz0, or a6sz1 and a6sz0, in bcr2. figure 10.43 shows an example of pcmcia card connection to the sh7709a. to enable active insertion of the pcmcia cards (i.e. insertion or removal while system power is being supplied), a 3-state buffer must be connected between the sh7709as bus interface and the pcmcia cards. as operation in big-endian mode is not explicitly stipulated in the jeida/pcmcia specifications, the pcmcia interface for the sh7709a in big-endian mode is stipulated independently.
334 a24 to a0 d15 to d0 rd/wr ce1b/(cs6) ce1a/(cs5) rd we iciord iciowr wait iois16 sh7709a a25 to a0 d15 to d0 ce2 oe we/pgm (iord) (iowr) wait (iois16) cd1, cd2 ce1 pc card (memory/io) g g g dir dir g d7 to d0 d15 to d8 a25 to a0 d15 to d0 ce2 oe we/pgm wait cd1, cd2 ce1 pc card (memory/io) g g g dir dir g d7 to d0 d15 to d8 ce2b ce2a output port card detection circuit card detection circuit figure 10.44 example of pcmcia interface
335 memory card interface basic timing: figure 10.45 shows the basic timing for the pcmcia ic memory card interface. when physical space areas 5 and 6 are designated as pcmcia interface areas, bus accesses are automatically performed as ic memory card interface accesses. with a high external bus frequency (ckio), the setup and hold times for the address (a24Ca0), card enable ( cs5 , ce2a , cs6 , ce2b ), and write data (d15Cd0) in a write cycle, become insufficient with respect to rd and wr (the we pin in the sh7709a). the sh7709a provides for this by enabling setup and hold times to be set for physical space areas 5 and 6 in the pcr register. also, software waits by means of a wcr2 register setting and hardware waits by means of the wait pin can be inserted in the same way as for the basic interface. figure 10.46 shows the pcmcia memory bus wait timing.
336 ckio tpcm1 tpcm2 a25 to a0 cexx rd/ wr d15 to d0 (read) d15 to d0 (read) rd (read) we (write) bs figure 10.45 basic timing for pcmcia memory card interface
337 ckio tpcm0 a25 to a0 rd/wr cexx rd (read) d15 to d0 (read) d15 to d0 (write) we (write) bs wait tpcm0w tpcm1 tpcm1w tpcm1w tpcm2 tpcm2w figure 10.46 wait timing for pcmcia memory card interface
338 memory card interface burst timing: in the sh7709a, when the ic memory card interface is selected, page mode burst access mode can be used, for read access only, by setting bits a5bst1 and a5bst0 in bcr1 for physical space area 5, or bits a6bst1 and a6bst0 in bcr1 for area 6. this burst access mode is not stipulated in jeida version 4.2 (pcmcia2.1), but allows high- speed data access using rom provided with a burst mode, etc. burst access mode timing is shown in figures 10.47 and 10.48. ckio tpcm1 a25 to a4 cexx a3 to a0 rd/ wr rd (read) d15 to d0 (read) bs tpcm2 tpcm1 tpcm2 tpcm1 tpcm2 tpcm1 tpcm2 figure 10.47 basic timing for pcmcia memory card interface burst access
339 ckio tpcm0 a25 to a4 cexx a3 to a0 rd/wr rd (read) d15 to d0 (read) bs wait tpcm1 tpcm1w tpcm1w tpcm1w tpcm2 tpcm1 tpcm1w tpcm2 tpcm2w figure 10.48 wait timing for pcmcia memory card interface burst access
340 when the entire 32-mbyte memory space is used as ic memory card interface space, the common memory/attribute memory switching signal reg is generated using a port, etc. if 16-mbytes or less of memory space is sufficient, using 16 mbytes of memory space as common memory space and 16 mbytes as attribute memory space enables the a24 pin to be used for the reg signal. i/o space i/o space i/o space area 5: h'14000000 area 5: h'16000000 area 6: h'18000000 area 6: h'1a000000 area 5: h'14000000 area 5: h'15000000 area 5: h'16000000 h'17000000 area 6: h'18000000 area 6: h'19000000 area 6: h'1a000000 h'1b000000 attribute memory common memory attribute memory common memory i/o space up to 16-mbyte capacity (reg = a24) 32-mbyte capacity (reg = i/o port) common memory/ attribute memory common memory/ attribute memory figure 10.49 pcmcia space allocation
341 i/o card interface timing: figures 10.50 and 10.51 show the timing for the pcmcia i/o card interface. switching between the i/o card interface and the ic memory card interface is performed according to the accessed address. when pcmcia is designed for physical space area 5, the bus access is automatically performed as an i/o card interface access when a physical address from h'16000000 to h'17ffffff is accessed. when pcmcia is designated for physical space area 6, the bus access is automatically performed as an i/o card interface access when a physical address from h'1a000000 to h'1bffffff is accessed. when accessing a pcmcia i/o card, the access should be performed using a non-cacheable area in virtual space (p2 or p3 space) or an area specified as non-cacheable by the mmu. when an i/o card interface access is made to a pcmcia card in little-endian mode, dynamic sizing of the i/o bus width is possible using the iois16 pin. when a 16-bit bus width is set for area 6, if the iois16 signal is high during a word-size i/o bus cycle, the i/o port is recognized as being 8 bits in width. in this case, a data access for only 8 bits is performed in the i/o bus cycle being executed, followed automatically by a data access for the remaining 8 bits. figure 10.52 shows the basic timing for dynamic bus sizing. in big-endian mode, the iois16 signal is not supported. in big-endian mode, the iois16 signal should be fixed low.
342 ckio tpci1 tpci2 a25 to a0 rd/wr cexx iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs figure 10.50 basic timing for pcmcia i/o card interface
343 ckio a25 to a0 rd/wr cexx iciord (read) iciowr (write) d15 to d0 (read) d15 to d0 (write) bs wait iois16 tpci0 tpci0w tpci1 tpci1w tpci1w tpci2 tpci2w figure 10.51 wait timing for pcmcia i/o card interface
344 ckio tpci0 a25 to a1 cexx a0 rd/wr iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs wait iois16 tpci1 tpci1w tpci2 tpci1 tpci1w tpci2 tpci2w figure 10.52 dynamic bus sizing timing for pcmcia i/o card interface
345 10.3.8 waits between access cycles a problem associated with higher external memory bus operating frequencies is that data buffer turn-off on completion of a read from a low-speed device may be too slow, causing a collision with data in the next access. this results in lower reliability or incorrect operation. to avoid this problem, a data collision prevention feature has been provided. this memorizes the preceding access area and the kind of read/write. if there is a possibility of a bus collision when the next access is started, a wait cycle is inserted before the access cycle thus preventing a data collision. there are two cases in which a wait cycle is inserted: when an access is followed by an access to a different area, and when a read access is followed by a write access from the sh7709a. when the sh7709a performs consecutive write cycles, the data transfer direction is fixed (from the sh7709a to other memory) and there is no problem. with read accesses to the same area, in principle, data is output from the same data buffer, and wait cycle insertion is not performed. bits aniw1 and aniw0 (n = 0, 2C6) in wcr1 specify the number of idle cycles to be inserted between access cycles when a physical space area access is followed by an access to another area, or when the sh7709a performs a write access after a read access to physical space area n. if there is originally space between accesses, the number of idle cycles inserted is the specified number of idle cycles minus the number of empty cycles. waits are not inserted between accesses when bus arbitration is performed, since empty cycles are inserted for arbitration purposes.
346 t1 ckio csm csn a25 to a0 bs rd/wr rd d31 to d0 t2 twait t1 t2 twait t1 t2 area m read area m inter-access wait specification area n inter-access wait specification area n space read area n space write figure 10.53 waits between access cycles 10.3.9 bus arbitration when a bus release request ( breq ) is received from an external device, buses are released after the bus cycle being executed is completed and a bus grant signal ( back ) is output . the bus is not released during burst transfers for cache fills or tas instruction execution between the read cycle and write cycle. bus arbitration is not executed in multiple bus cycles that are generated when the data bus width is shorter than the access size; i.e. in the bus cycles when longword access is executed for the 8-bit memory. at the negation of breq , back is negated and bus use is restarted . see appendix a.1, pin states, for the pin state when the bus is released. the sh7709a sometimes needs to retrieve a bus it has released. for example, when memory generates a refresh request or an interrupt request internally, the sh7709a must perform the appropriate processing. the sh7709a has a bus request signal ( irqout ) for this purpose. when it must retrieve the bus, it asserts the irqout signal. devices asserting an external bus release request receive the assertion of the irqout signal and negate the breq signal to release the bus. the sh7709a retrieves the bus and carries out the processing.
347 irqout pin assertion conditions: ? when a memory refresh request has been generated but the refresh cycle has not yet begun ? when an interrupt is generated with an interrupt request level higher than the setting of the interrupt mask bits (i3Ci0) in the status register (sr). (this does not depend on the sr.bl bit.) 10.3.10 bus pull-up with the sh7709a, address pin pull-up can be performed when the bus is released by setting the pula bit in bcr1 to 1. the address pins are pulled up for a 4-clock period after back is asserted. figure 10.54 shows the address pin pull-up timing. similarly, data pin pull-up can be performed by setting the puld bit in bcr1 to 1. the data pins should be pulled up when the data bus is not in use. the data pin pull-up timing for a read cycle is shown in figure 10.55, and the timing for a write cycle in figure 10.56. hi-z pull-up ckio a25 to a0 back figure 10.54 pins a25 to a0 pull-up timing
348 pull-up ckio d31 to d0 rd csn pull-up figure 10.55 pins d31 to d0 pull-up timing (read cycle) pull-up ckio d31 to d0 wen csn pull-up figure 10.56 pins d31 to d0 pull-up timing (write cycle)
349 10.3.11 mcs[0] to mcs[7] pin control the sh7709a is provided with pins mcs[0] C mcs[7] as dedicated cs pins for the rom connected to area 0 or 2. assertion of mcs[0] C mcs[7] is controlled by settings in mcscr0C mcscr7. this enables 32-, 64-, 128-, or 256-mbit memory to be connected to area 0 or area 2. table 10.16 shows mcscr0Cmcscr7 settings and mcs[0] C mcs[7] assertion conditions. as the mcs[0] C mcs[7] pins are multiplexed as the ptc0Cptc7 pins, when using these pins as mcs[0] C mcs[7] , the corresponding bits in the pccr register should be set to other function. when cs2/0 = 0 in the mcscr0 and when the ptc0 pin is switched to mcs[0] (when pcomd1Cpcomd0 are set to other function), the cs0 pin is also switched to mcs[0] . as port register writes operate on the peripheral clock, they take time compared with instruction execution by the cpu operating on the high-speed internal clock. therefore, if an instruction that accesses mcs[1] to mcs[7] is located several instructions after an instruction that switches port c to mcs , the switch from ptc[n] to mcs[n] and from cs0 to mcs[0] may not be performed correctly. to prevent this problem, the following switching procedure should be used. ? when the program runs with cache on (1) to switch port c to mcs , set the corresponding bits in the pccr register to 00 ("other function"). (2) read the pccr register and check whether the set value is read. repeat until the set value is read. (3) perform a dummy read from non-cacheable cs0 space (e.g. address h'a0000000). this will result in an access to the cs0 space, and immediately afterward, cs0 will be switched to mcs[0] , and port c[n] will be switched to mcs[n] . (4) access can now be made to the mcs[1] to mcs[7] spaces. ? when the program runs in mcs[0] space with cache off (1) set the pccr register as in (1) above. (2) place at least three nop instructions after the instruction in (1). as a result, when the pccr register is rewritten, an access to the cs0 space will be generated, and immediately afterward, cs0 will be switched to mcs[0] , and port c[n] will be switched to mcs[n] . (3) access can now be made to the mcs[1] to mcs[7] spaces.
350 table 10.16 mcscrx settings and mcs[x] assertion conditions (x: 0C7) mcscrx settings mcs[x] assertion conditions cs2/0 cap1 cap0 a25 a24 a23 a22 cs0 cs2 address bus a [25:0] notes 0110lhh' 0000000 to h'1ffffff 256-mbit rom 1 l h h'2000000 to h'3ffffff 1 0 0 0 l h h'0000000 to h'0ffffff 128-mbit rom 0 1 l h h'1000000 to h'1ffffff 1 0 l h h'2000000 to h'2ffffff 1 1 l h h'3000000 to h'3ffffff 0 1 000 l hh' 0000000 to h'07fffff 64-mbit rom 001 l hh' 0800000 to h'0ffffff 010 l hh' 1000000 to h'17fffff 011 l hh' 1800000 to h'1ffffff 100 l hh' 2000000 to h'27fffff 101 l hh' 2800000 to h'2ffffff 110 l hh' 3000000 to h'37fffff 111 l hh' 3800000 to h'3ffffff 0 0 0000 l hh' 0000000 to h'03fffff 32-mbit rom 0001 l hh' 0400000 to h'07fffff 0010 l hh' 0800000 to h'0bfffff 0011 l hh' 0c00000 to h'0ffffff 0100 l hh' 1000000 to h'13fffff 0101 l hh' 1400000 to h'17fffff 0110 l hh' 1800000 to h'1bfffff 0111 l hh' 1c00000 to h'1ffffff 1000 l hh' 2000000 to h'23fffff 1001 l hh' 2400000 to h'27fffff 1010 l hh' 2800000 to h'2bfffff 1011 l hh' 2c00000 to h'2ffffff 1100 l hh' 3000000 to h'33fffff 1101 l hh' 3400000 to h'37fffff 1110 l hh' 3800000 to h'3bfffff 1111 l hh' 3c00000 to h'3ffffff
351 table 10.16 mcscrx settings and mcs[x] assertion conditions (x: 0C7) (cont) mcscrx settings mcs[x] assertion conditions cs2/0 cap1 cap0 a25 a24 a23 a22 cs0 cs2 address bus a[25:0] notes 1110hlh' 0000000 to h'1ffffff 256-mbit rom 1 h l h'2000000 to h'3ffffff 1 0 0 0 h l h'0000000 to h'0ffffff 128-mbit rom 0 1 h l h'1000000 to h'1ffffff 1 0 h l h'2000000 to h'2ffffff 1 1 h l h'3000000 to h'3ffffff 0 1 000 hl h' 0000000 to h'07fffff 64-mbit rom 001 hl h' 0800000 to h'0ffffff 010 hl h' 1000000 to h'17fffff 011 hl h' 1800000 to h'1ffffff 100 hl h' 2000000 to h'27fffff 101 hl h' 2800000 to h'2ffffff 110 hl h' 3000000 to h'37fffff 111 hl h' 3800000 to h'3ffffff 0 0 0000 hl h' 0000000 to h'03fffff 32-mbit rom 0001 hl h' 0400000 to h'07fffff 0010 hl h' 0800000 to h'0bfffff 0011 hl h' 0c00000 to h'0ffffff 0100 hl h' 1000000 to h'13fffff 0101 hl h' 1400000 to h'17fffff 0110 hl h' 1800000 to h'1bfffff 0111 hl h' 1c00000 to h'1ffffff 1000 hl h' 2000000 to h'23fffff 1001 hl h' 2400000 to h'27fffff 1010 hl h' 2800000 to h'2bfffff 1011 hl h' 2c00000 to h'2ffffff 1100 hl h' 3000000 to h'33fffff 1101 hl h' 3400000 to h'37fffff 1110 hl h' 3800000 to h'3bfffff 1111 hl h' 3c00000 to h'3ffffff
352
353 section 11 direct memory access controller (dmac) 11.1 overview this chip includes a four-channel direct memory access controller (dmac). the dmac can be used in place of the cpu to perform high-speed transfers between external devices that have dack (transfer request acknowledge signal), external memory, memory-mapped external devices, and on-chip peripheral modules (irda, scif, a/d converter, and d/a converter). using the dmac reduces the burden on the cpu and increases overall operating efficiency. 11.1.1 features the dmac has the following features. ? four channels ? 4-gb physical address space ? 8-bit, 16-bit, 32-bit, or 16-byte transfer (in 16-byte transfer, four 32-bit reads are executed, followed by four 32-bit writes.) ? 16 mbytes (16777216 transfers) ? address mode: dual address mode and single address mode are supported. in addition, direct address transfer mode or indirect address transfer mode can be selected. ? dual address mode transfer: both the transfer source and transfer destination are accessed by address. dual address mode has direct address transfer mode and indirect address transfer mode. direct address transfer mode: the values specified in the dmac registers indicates the transfer source and transfer destination. two bus cycles are required for one data transfer. indirect address transfer mode: data is transferred with the address stored prior to the address specified in the transfer source address in the dmac. other operations are the same as those of direct address transfer mode. this function is only valid in channel 3. four bus cycles are requested for one data transfer. ? single address mode transfer: either the transfer source or transfer destination peripheral device is accessed (selected) by means of the dack signal, and the other device is accessed by address. one transfer unit of data is transferred in one bus cycle. ? channel functions: transfer mode that can be specified is different in each channel. ? channel 0: external request can be accepted. ? channel 1: external request can be accepted. ? channel 2: this channel has a source address reload function, which reloads a source address for each 4 transfers. ? channel 3: in this channel, direct address mode or indirect address transfer mode can be specified.
354 ? reload function: the value that was specified in the source address register can be automatically reloaded every 4 dma transfers. this function is only valid in channel 2. ? transfer requests ? external request (from two dreq pins (channels 0 and 1 only). dreq can be detected either by edge or by level) ? on-chip module request (requests from on-chip peripheral modules such as serial communications interface (irda and scif), a/d converter (a/d) and a timer (cmt). this request can be accepted in all the channels) ? auto request (the transfer request is generated automatically within the dmac) ? selectable bus modes: cycle-steal mode or burst mode ? selectable channel priority levels: fixed mode: the channel priority is fixed. round-robin mode: the priority of the channel in which the execution request was accepted is made the lowest. ? interrupt request: an interrupt request can be generated to the cpu after transfers end by the specified counts.
355 11.1.2 block diagram figure 11.1 is a block diagram of the dmac. peripheral bus internal bus dreq0 , dreq1 interation control sarn dmac module register control start-up control request priority control bus interface bus state controller on-chip peripheral module darn dmatcrn chcrn dmaor irda, scif a/d converter cmt dein external ram external rom external i/o (memory mapped) external i/o (with acknowledge) dack0, dack1 drak0, drak1 dmaor: sarn: darn: dmatcrn: chcrn: dein: n: dmac operation register dmac source address register dmac destination address register dmac transfer count register dmac channel control register dma transfer-end interrupt request to 4 0 to 3 legend: figure 11.1 dmac block diagram
356 11.1.3 pin configuration table 11.1 shows the dmac pins. table 11.1 pin configuration channel name symbol i/o function 0 dma transfer request dreq0 i dma transfer request input from external device to channel 0 dreq acknowledge dack0 o strobe output to an external i/o at dma transfer request from external device to channel 0 dma request acknowledge drak0 o output showing that dreq0 has been accepted 1 dma transfer request dreq1 i dma transfer request input from external device to channel 1 dreq acknowledge dack1 o strobe output to an external i/o at dma transfer request from external device to channel 1 dma request acknowledge drak1 o output showing that dreq1 has been accepted 11.1.4 register configuration table 11.2 summarizes the dmac registers. dmac has a total of 17 registers. each channel has four control registers. one other control register is shared by all channels. table 11.2 dmac registers channel name abbrevi- ation r/w initial value address register size access size 0 dma source address register 0 sar0 r/w undefined h'04000020 (h'a4000020) * 4 32 bits 16, 32 * 2 dma destination address register 0 dar0 r/w undefined h'04000024 (h'a4000024) * 4 32 bits 16, 32 * 2 dma transfer count register 0 dmatcr0 r/w undefined h'04000028 (h'a4000028) * 4 24 bits 16, 32 * 3 dma channel control register 0 chcr0 r/w * 1 h'00000000 h'0400002c (h'a400002c) * 4 32 bits 8, 16, 32 * 2
357 table 11.2 dmac registers (cont) channel name abbrevi- ation r/w initial value address register size access size 1 dma source address register 1 sar1 r/w undefined h'04000030 (h'a4000030) * 4 32 bits 16, 32 * 2 dma destination address register 1 dar1 r/w undefined h'04000034 (h'a4000034) * 4 32 bits 16, 32 * 2 dma transfer count register 1 dmatcr1 r/w undefined h'04000038 (h'a4000038) * 4 24 bits 16, 32 * 3 dma channel control register 1 chcr1 r/w * 1 h'00000000 h'0400003c (h'a400003c) * 4 32 bits 8, 16, 32 * 2 2 dma source address register 2 sar2 r/w undefined h'04000040 (h'a4000040) * 4 32 bits 16, 32 * 2 dma destination address register 2 dar2 r/w undefined h'04000044 (h'a4000044) * 4 32 bits 16, 32 * 2 dma transfer count register 2 dmatcr2 r/w undefined h'04000048 (h'a4000048) * 4 24 bits 16, 32 * 3 dma channel control register 2 chcr2 r/w * 1 h'00000000 h'0400004c (h'a400004c) * 4 32 bits 8, 16, 32 * 2 3 dma source address register 3 sar3 r/w undefined h'04000050 (h'a4000050) * 4 32 bits 16, 32 * 2 dma destination address register 3 dar3 r/w undefined h'04000054 (h'a4000054) * 4 32 bits 16, 32 * 2 dma transfer count register 3 dmatcr3 r/w undefined h'04000058 (h'a4000058) * 4 24 bits 16, 32 * 3 dma channel control register 3 chcr3 r/w * 1 h'00000000 h'0400005c (h'a400005c) * 4 32 bits 8, 16, 32 * 2 shared dma operation register dmaor r/w * 1 h'0000 h'04000060 (h'a4000060) * 4 16 bits 8, 16 * 2 notes: these registers are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 only 0s can be written to bits 1 of chcr0 to chcr3, and bits 1 and 2 of dmaor to clear flag after 1 is read. * 2 if sar0 to sar3, dar0 to dar3, and chcr0 to chcr3 are accessed in 16 bits, the value in 16 bits that were not accessed are held. * 3 dmatcr has 24 bits from dmatcr0 to dmatcr23. therefore, even if 1s are written to upper 24 to 31 bits, it is invalid; 0s are always read if these bits are read. * 4 when address translation by the mmu does not apply, the address in parentheses should be used.
358 11.2 register descriptions 11.2.1 dma source address registers 0C3 (sar0Csar3) dma source address registers 0C3 (sar0Csar3) are 32-bit read/write registers that specify the source address of a dma transfer. during a dma transfer, these registers indicate the next source address. to transfer data in 16 bits or in 32 bits, specify the address with 16-bit or 32-bit address boundary. when transferring data in 16-byte units, a 16-byte boundary (address 16n) must be set for the source address value. specifying other addresses does not guarantee operation. the initial value is undefined by resets. the previous value is held in standby mode. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 0 initial value: r/w: r/w r/w r/w r/w r/w
359 11.2.2 dma destination address registers 0C3 (dar0Cdar3) dma destination address registers 0C3 (dar0Cdar3) are 32-bit read/write registers that specify the destination address of a dma transfer. these registers include count functions, and during a dma transfer, these registers indicate the next destination address. to transfer data in 16 bits or in 32 bits, specify the address with 16-bit or 32-bit address boundary. specifying other addresses does not guarantee operation. the initial value is undefined by resets. the previous value is held in standby mode. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 0 initial value: r/w: r/w r/w r/w r/w r/w
360 11.2.3 dma transfer count registers 0C3 (dmatcr0Cdmatcr3) dma transfer count registers 0C3 (dmatcr0Cdmatcr3) are 24-bit read/write registers that specify the dma transfer count (bytes, words, or longwords). the number of transfers is 1 when the setting is h'000001, and 16777216 (the maximum) when h'000000 is set. during a dma transfer, these registers indicate the remaining transfer count. to transfer data in 16 bytes, one 16-byte transfer (128 bits) counts one. writing to upper eight bits in dmatcr is invalid; 0s are read if these bits are read. when using 16-byte transfer, an integral multiple of 4 (4n) must be set for the number of transfers to ensure normal operation. the initial value is undefined by resets. the previous value is held in standby mode. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r r r r r r r r bit: 23 22 21 20 ... 0 ... initial value: ... r/w: r/w r/w r/w r/w ... r/w
361 11.2.4 dma channel control registers 0C3 (chcr0Cchcr3) dma channel control registers 0C3 (chcr0Cchcr3) are 32-bit read/write registers that specifies operation mode, transfer method, or others in each channel. writing to bits 31 to 21 and 7 in this register is invalid; 0 s are read if these bits are read. bit 20 is only used in chcr3. it is not used in chcr0 to chcr2. consequently, writing to this bit is invalid in chcr0 to chcr2; 0 is read if this bit is read. bit 19 is only used in chcr2; it is not used in chcr0, chcr1, and chcr3. consequently, writing to this bit is invalid in chcr0, chcr1, and chcr3; 0 is read if this bit is read. bits 6 and 16 to 18 are only used in chcr0 and chcr1; they are not used in chcr2 and chcr3. consequently, writing to these bits is invalid in chcr2 and chcr3; 0s are read if these bits are read. these register values are initialized to 0s after power-on resets. the previous value is held in standby mode. bit: 31 ... 21 20 19 18 17 16 ... di ro rl am al initial value: 0 ... 0 0 0 0 0 0 r/w: r ... r (r/w) * 2 (r/w) * 2 (r/w) * 2 (r/w) * 2 (r/w) * 2 bit: 15 14 13 12 11 10 9 8 dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ds tm ts1 ts0 ie te de initial value: 0 0 0 0 0 0 0 0 r/w: r (r/w) * 2 r/w r/w r/w r/w r/(w) * 1 r/w notes: 1. only 0 can be written to the te bit after 1 is read. 2. di, ro, rl, am, al, and ds bits are not included in some channels. bits 31 to 21reserved: these bits are always read as 0. the write value should always be 0.
362 bit 20direct/indirect selection (di): di selects direct address mode or indirect address mode in channel 3. this bit is only valid in chcr3. writing to this bit is invalid in chcr0 to chcr2; 0 is read if this bit is read. when using 16-byte transfer, direct address mode must be specified. operation is not guaranteed if indirect address mode is specified. bit 20: di description 0 direct address mode (initial value) 1 indirect address mode bit 19source address reload bit (ro): ro selects whether the source address initial value is reloaded in channel 2. this bit is only valid in chcr2. writing to this bit is invalid in chcr0, chcr1, and chcr3; 0 is read if this bit is read. when using 16-byte transfer, this bit must be cleared to 0, specifying non- reloading. operation is not guaranteed if reloading is specified. bit 19: ro description 0 a source address is not reloaded (initial value) 1 a source address is reloaded bit 18request check level bit (rl): rl specifies the drak (acknowledge of dreq ) signal output is high active or low active. this bit is only valid in chcr0 and chcr1. writing to this bit is invalid in chcr2 and chcr3; 0 is read if this bit is read. bit 18: rl description 0 low-active output of drak (initial value) 1 high-active output of drak bit 17acknowledge mode bit (am): am specifies whether dack is output in data read cycle or in data write cycle in dual address mode. this bit is only valid in chcr0 and chcr1. writing to this bit is invalid in chcr2 and chcr3; 0 is read if this bit is read. bit 17: am description 0 dack output in read cycle (initial value) 1 dack output in write cycle
363 bit 16acknowledge level (al): al specifies the dack (acknowledge) signal output is high active or low active. this bit is only valid in chcr0 and chcr1. writing to this bit is invalid in chcr2 and chcr3; 0 is read if this bit is read. bit 16: al description 0 low-active output of dack (initial value) 1 high-active output of dack bits 15 and 14destination address mode bits 1, 0 (dm1, m0): dm1 and dm0 select whether the dma destination address is incremented, decremented, or left fixed. bit 15: dm1 bit 14: dm0 description 0 0 fixed destination address (initial value) 0 1 destination address is incremented (+1 in 8-bit transfer, +2 in 16-bit transfer, +4 in 32-bit transfer, +16 in 16-byte transfer) 1 0 destination address is decremented (C1 in 8-bit transfer, C2 in 16-bit transfer, C4 in 32-bit transfer; illegal setting in 16-byte transfer) 1 1 illegal setting bits 13 and 12source address mode bits 1, 0 (sm1, sm0): sm1 and sm0 select whether the dma source address is incremented, decremented, or left fixed. bit 13: sm1 bit 12: sm0 description 0 0 fixed source address (initial value) 0 1 source address is incremented (+1 in 8-bit transfer, +2 in 16- bit transfer, +4 in 32-bit transfer, +16 in 16-byte transfer) 1 0 source address is decremented (C1 in 8-bit transfer, C2 in 16- bit transfer, C4 in 32-bit transfer; illegal setting in 16-byte transfer) 1 1 reserved (illegal setting) if the transfer source is specified in indirect address, specify the address, in which the data to be transferred is stored and which is stored as data (indirect address), in source address register 3 (sar3). specification of sar3 increment or decrement in indirect address mode depends on sm1 and sm0 settings. in this case, however, the sar3 increment or decrement value is +4, C4, or fixed to 0 regardless of the transfer data size specified in ts1 and ts0.
364 bits 11 to 8resource select bits 3C0 (rs3Crs0): rs3Crs0 specify which transfer requests will be sent to the dmac. bit 11: rs3 bit 10: rs2 bit 9: rs1 bit 8: rs0 description 0000 external request * , dual address mode (initial value) 0001 illegal setting 0010 external request / single address mode external address space external device with dack 0011 external request / single address mode external device with dack external address space 0100 auto request 0101 illegal setting 0110 illegal setting 0111 illegal setting 1000 illegal setting 1001 illegal setting 1010 irda transmission 1011 irda reception 1100 scif transmission 1101 scif reception 1110 internal a/d 1111cmt note: when using 16-byte transfer, the following settings must not be made: 1010 irda transmission 1011 irda reception 1100 scif transmission 1101 scif reception 1110 a/d converter 1111 cmt operation is not guaranteed if these settings are made. * external request specification is valid only in channels 0 and 1. none of the request sources can be selected in channels 2 and 3. bit 7reserved: this bit is always read 0. the write value should always be 0.
365 bit 6 dreq select bit (ds): ds selects the sampling method of the dreq pin that is used in external request mode is detection in low level or at the falling edge. this bit is only valid in chcr0 and chcr1. writing to this bit is invalid in chcr2 and chcr3; 0 is read if this bit is read. in channel 0 and 1, if an on-chip peripheral module is specified as a transfer request source or an auto request is specified, specification of this bit is ignored and detection at the falling edge is fixed except in an auto-request. bit 6: ds description 0 dreq detected in low level (initial value) 1 dreq detected at falling edge bit 5transmit mode (tm): tm specifies the bus mode when transferring data. bit 5: tm description 0 cycle steal mode (initial value) 1 burst mode bits 4 and 3transmit size bits 1 and 0 (ts1, ts0): ts1 and ts0 specify the size of data to be transferred. bit 4: ts1 bit 3: ts0 description 0 0 byte size (8 bits) (initial value) 0 1 word size (16 bits) 1 0 longword size (32 bits) 1 1 16-byte unit (4 longword transfers) bit 2interrupt enable bit (ie): setting this bit to 1 generates an interrupt request when data transfer end (te = 1) by the count specified in dmatcr. bit 2: ie description 0 interrupt request is not generated even if data transfer ends by the specified count (initial value) 1 interrupt request is generated if data transfer ends by the specified count
366 bit 1transfer end bit (te): te is set to 1 when data transfer ends by the count specified in dmatcr. at this time, if the ie bit is set to 1, an interrupt request is generated. before this bit is set to 1, if data transfer ends due to an nmi interrupt, a dmac address error, or clearing the de bit or the dme bit in dmaor, this bit is not set to 1. even if the de bit is set to 1 while this bit is set to 1, transfer is not enabled. bit 1: te description 0 data transfer does not end by the count specified in dmatcr (initial value) clear condition: writing 0 after te = 1 read at power-on reset or manual reset 1 data transfer ends by the specified count bit 0dmac enable bit (de): de enables channel operation. bit 0: de description 0 disables channel operation (initial value) 1 enables channel operation if an auto request is specifies (specified in rs3 to rs0), transfer starts when this bit is set to 1. in an external request or an internal module request, transfer starts if transfer request is generated after this bit is set to 1. clearing this bit during transfer can terminate transfer. even if the de bit is set, transfer is not enabled if the te bit is 1, the dme bit in dmaor is 0, or the nmif bit in dmaor is 1.
367 11.2.5 dma operation register (dmaor) the dma operation register (dmaor) is a 16-bit read/write register that controls the dmac transfer mode. writing to bits 15 to 10 and bits 7 to 3 is invalid in this register; 0 is always read if these bits are read. it is initialized to 0 at power-on reset, or in hardware standby mode or software standby mode. bit: 15 14 13 12 11 10 9 8 pr1pr0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 ae nmif dme initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/(w) * r/(w) * r/w note: * only 0 can be written to the ae and nmif bits after 1 is read. bits 15 to 10reserved: these bits are always read as 0. the write value should always be 0. bits 9 and 8priority mode bits 1 and 0 (pr1, pr0): pr1 and pr0 select the priority level between channels when there are transfer requests for multiple channels simultaneously. bit 9: pr1 bit 8: pr0 description 0 0 ch0 > ch1 > ch2 > ch3 (initial value) 0 1 ch0 > ch2 > ch3 > ch1 1 0 ch2 > ch0 > ch1 > ch3 1 1 round-robin bits 7 to 3reserved: these bits are always read as 0. the write value should always be 0.
368 bit 2address error flag bit (ae): ae indicates that an address error occurred during dma transfer. if this bit is set during data transfer, transfers on all channels are suspended. the cpu cannot write 1 to this bit. this bit can only be cleared by writing 0 after reading 1. bit 2: ae description 0 no dmac address error. dma transfer is enabled. (initial value) clear conditions: writing ae = 0 after ae = 1 read power-on reset, manual reset 1 dmac address error. dma transfer is disabled. this bit is set by occurrence of a dmac address error. bit 1nmi flag bit (nmif): nmif indicates that an nmi interrupt occurred. this bit is set regardless of whether dmac is in operating or halt state. the cpu cannot write 1 to this bit. only 0 can be written to clear this bit after 1 is read. bit 1: nmif description 0 no nmi input. dma transfer is enabled. (initial value) clear condition: writing nmif = 0 after nmif = 1 read at power-on reset or manual reset 1 nmi input. dma transfer is disabled. this bit is set by occurrence of an nmi interrupt. bit 0dma master enable bit (dme): dme enables or disables dma transfers on all channels. if the dme bit and the de bit corresponding to each channel in chcr are set to 1s, transfer is enabled in the corresponding channel. if this bit is cleared during transfer, transfers in all the channels can be terminated. even if the dme bit is set, transfer is not enabled if the te bit is 1 or the de bit is 0 in chcr, or the nmif bit is 1 in dmaor. bit 0: dme description 0 disable dma transfers on all channels (initial value) 1 enable dma transfers on all channels
369 11.3 operation when there is a dma transfer request, the dmac starts the transfer according to the predetermined channel priority order; when the transfer end conditions are satisfied, it ends the transfer. transfers can be requested in three modes: auto request, external request, and on-chip module request. the dual address mode has direct address transfer mode and indirect address transfer mode. in the bus mode, the burst mode or the cycle steal mode can be selected. 11.3.1 dma transfer flow after the dma source address registers (sar), dma destination address registers (dar), dma transfer count registers (dmatcr), dma channel control registers (chcr), and dma operation register (dmaor) are set, the dmac transfers data according to the following procedure: 1. checks to see if transfer is enabled (de = 1, dme = 1, te = 0, nmif = 0) 2. when a transfer request comes and transfer is enabled, the dmac transfers 1 transfer unit of data (depending on the ts0 and ts1 settings). for an auto request, the transfer begins automatically when the de bit and dme bit are set to 1. the dmatcr value will be decremented for each transfer. the actual transfer flows vary by address mode and bus mode. 3. when the specified number of transfer have been completed (when dmatcr reaches 0), the transfer ends normally. if the ie bit of the chcr is set to 1 at this time, a dei interrupt is sent to the cpu. 4. when an nmi interrupt is generated, the transfer is aborted. transfers are also aborted when the de bit of the chcr or the dme bit of the dmaor are changed to 0. figure 11.2 is a flowchart of this procedure.
370 normal end does nmif = 1 or de = 0 or dme = 0? bus mode, transfer request mode, dreq detection selection system initial settings (sar, dar, dmatcr, chcr, dmaor) transfer (1 transfer unit); dmatcr C 1 dmatcr, sar and dar updated dei interrupt request (when ie = 1) no yes no yes no yes yes no yes no * 3 * 2 start transfer aborted notes: * 1 * 2 * 3 in auto-request mode, transfer begins when nmif and te are all 0 and the de and dme bits are set to 1. dreq = level detection in burst mode (external request) or cycle-steal mode. dreq = edge detection in burst mode (external request), or auto-request mode in burst mode. dmatcr = 0? transfer request occurs? * 1 de, dme = 1 and nmif, te = 0? does nmif = 1 or de = 0 or dme = 0? transfer end figure 11.2 dmac transfer flowchart
371 11.3.2 dma transfer requests dma transfer requests are basically generated in either the data transfer source or destination, but they can also be generated by devices and on-chip peripheral modules that are neither the source nor the destination. transfers can be requested in three modes: auto request, external request, and on-chip module request. the request mode is selected in the rs3Crs0 bits of the dma channel control registers 0C3 (chcr0Cchcr3). auto-request mode: when there is no transfer request signal from an external source, as in a memory-to-memory transfer or a transfer between memory and an on-chip peripheral module unable to request a transfer, the auto-request mode allows the dmac to automatically generate a transfer request signal internally. when the de bits of chcr0Cchcr3 and the dme bit of the dmaor are set to 1, the transfer begins so long as the te bits of chcr0Cchcr3 and the nmif bit of dmaor are all 0. external request mode: in this mode a transfer is performed at the request signal ( dreq ) of an external device. choose one of the modes shown in table 11.3 according to the application system. when this mode is selected, if the dma transfer is enabled (de = 1, dme = 1, te = 0, nmif = 0), a transfer is performed upon a request at the dreq input. choose to detect dreq by either the falling edge or low level of the signal input with the ds bit of chcr0Cchcr3 (ds = 0 is level detection, ds = 1 is edge detection). the source of the transfer request does not have to be the data transfer source or destination. table 11.3 selecting external request modes with the rs bits rs3 rs2 rs1 rs0 address mode source destination 0000 dual address mode any * any * 1 0 single address mode external memory, memory-mapped external device external device with dack 1 external device with dack external memory, memory-mapped external device note: * external memory, memory-mapped external device, on-chip memory, on-chip peripheral module (excluding dmac, ubc, and bsc) on-chip module request: in this mode a transfer is performed at the transfer request signal (interrupt request signal) of an on-chip module. this mode cannot be set in case of 16-byte transfer. the transfer request signals include 6 signals: the receive data full interrupts (rxi) and the transmit data empty interrupts (txi) from two serial communication interfaces (irda, scif), the a/d conversion end interrupt (adi) of the a/d converter and the compare match timer interrupt (cmi) of the cmt (table 11.4). when this mode is selected, if the dma transfer is
372 enabled (de = 1, dme = 1, te = 0, nmif = 0), a transfer is performed upon the input of a transfer request signal. the source of the transfer request does not have to be the data transfer source or destination. when rxi is set as the transfer request, however, the transfer source must be the sci's receive data register (rdr). likewise, when txi is set as the transfer request, the transfer source must be the sci's transmit data register (tdr). and if the transfer requester is the a/d converter, the data transfer source must be the a/d data register (addr). table 11.4 selecting on-chip peripheral module request modes with the rs bit rs3 rs2 rs1 rs0 dma transfer request source dma transfer request signal source desti- nation bus mode 1 0 1 0 irda transmitter txi1 (irda transmit data empty interrupt transfer request) any * tdr1 burst/ cycle steal 1 0 1 1 irda receiver rxi1 (irda receive data full interrupt transfer request) rdr1 any * burst/ cycle steal 1 1 0 0 scif transmitter txi2 (scif transmit data empty interrupt transfer request) any * tdr2 burst/ cycle steal 1 1 0 1 scif receiver rxi2 (scif receive data full interrupt transfer request) rdr1 any * burst/ cycle steal 1110a/d converter adi (a/d conversion end interrupt) addr any * burst/ cycle steal 1 1 1 1 cmt cmi (compare match timer interrupt) any * any * burst/ cycle steal addr: a/d data register of a/d converter note: * external memory, memory-mapped external device, on-chip peripheral module (excluding dmac, ubc , and bsc) when outputting transfer requests from on-chip peripheral modules, the appropriate interrupt enable bits must be set to output the interrupt signals. if the interrupt request signal of the on-chip peripheral module is used as a dma transfer request signal, an interrupt is not generated to the cpu. the dma transfer request signals of table 11.4 are automatically withdrawn when the corresponding dma transfer is performed. if the cycle steal mode is being employed, they are withdrawn at the first transfer; if the burst mode is being used, they are withdrawn at the last transfer.
373 11.3.3 channel priority when the dmac receives simultaneous transfer requests on two or more channels, it selects a channel according to a predetermined priority order. two modes (fixed mode and round-robin mode) are selected by the priority bits pr1 and pr0 in the dma operation register (dmaor). fixed mode: in these modes, the priority levels among the channels remain fixed. there are three kinds of fixed modes as follows: ch0 > ch1 > ch2 > ch3 ch0 > ch2 > ch3 > ch1 ch2 > ch0 > ch1 > ch3 these are selected by the pr1 and the pr0 bits in the dma operation register (dmaor). round-robin mode: each time one word, byte, or longword is transferred on one channel, the priority order is rotated. the channel on which the transfer was just finished rotates to the bottom of the priority order. the round-robin mode operation is shown in figure 11.3. the priority of the round-robin mode is ch0 > ch1 > ch2 > ch3 immediately after reset.
374 ch1 > ch2 > ch3 > ch0 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch0 > ch1 > ch2 > ch3 ch3 > ch0 > ch1 > ch2 ch0 > ch1 > ch2 > ch3 (1) when channel 0 transfers initial priority order initial priority order initial priority order priority order afrer transfer priority order afrer transfer priority order does not change channel 2 becomes bottom priority. the priority of channels 0 and 1, which were higher than channel 2, are also shifted. if immediately after there is a request to transfer channel 1 only, channel 1 becomes bottom priority and the priority of channels 0 and 3, which were higher than channel 1, are also shifted. channel 0 becomes bottom priority. the priority of channel 0, which was higher than channel 3, is also shifted. channel 0 becomes bottom priority priority order afrer transfer priority order afrer transfer priority order afrer transfer post-transfer priority order when there is an immediate transfer request to channel 1 only (2) when channel 1 transfers (3) when channel 2 transfers (4) when channel 3 transfers figure 11.3 round-robin mode
375 figure 11.4 shows how the priority order changes when channel 0 and channel 3 transfers are requested simultaneously and a channel 1 transfer is requested during the channel 0 transfer. the dmac operates as follows: 1. transfer requests are generated simultaneously to channels 0 and 3. 2. channel 0 has a higher priority, so the channel 0 transfer begins first (channel 3 waits for transfer). 3. a channel 1 transfer request occurs during the channel 0 transfer (channels 1 and 3 are both waiting) 4. when the channel 0 transfer ends, channel 0 becomes lowest priority. 5. at this point, channel 1 has a higher priority than channel 3, so the channel 1 transfer begins (channel 3 waits for transfer). 6. when the channel 1 transfer ends, channel 1 becomes lowest priority. 7. the channel 3 transfer begins. 8. when the channel 3 transfer ends, channels 3 and 2 shift downward in priority so that channel 3 becomes the lowest priority. transfer request waiting channel(s) dmac operation channel priority (1) channels 0 and 3 (3) channel 1 0 > 1 > 2 > 3 (2) channel 0 transfer start (4) channel 0 transfer ends (5) channel 1 transfer starts (6) channel 1 transfer ends (7) channel 3 transfer starts (8) channel 3 transfer ends 1 > 2 > 3 > 0 2 > 3 > 0 > 1 0 > 1 > 2 > 3 priority order changes priority order changes priority order changes none 3 3 1,3 figure 11.4 changes in channel priority in round-robin mode
376 11.3.4 dma transfer types the dmac supports the transfers shown in table 11.5. in the dual address mode, both the transfer source address and the transfer destination address are output. the dual address mode has the direct address mode and the indirect address mode. in the direct address mode, an output address value is the data transfer target address; in the indirect address mode, the value stored in the output address, not the output address value itself, is the data transfer target address. a data transfer timing depends on the bus mode, which has cycle steal mode and burst mode. table 11.5 supported dma transfers destination source external device with dack external memory memory- mapped external device on-chip peripheral module external device with dack not available dual, single dual, single not available external memory dual, single dual dual dual memory-mapped external device dual, single dual dual dual on-chip peripheral module not available dual dual dual notes: 1. dual: dual address mode 2. single: single address mode 3. the dual address mode includes the direct address mode and the indirect address mode. 4. 16-byte transfer is not available for on-chip peripheral modules. address modes: ? dual address mode in the dual address mode, both the transfer source and destination are accessed (selectable) by an address. the source and destination can be located externally or internally. the dual address mode has (1) direct address transfer mode and (2) indirect address transfer mode.
377 (1) in the direct address transfer mode, dma transfer requires two bus cycles because data is read from the transfer source in a data read cycle and written to the transfer destination in a data write cycle. at this time, transfer data is temporarily stored in the dmac. in the transfer between external memories as shown in figure 11.5, data is read to the dmac from one external memory in a data read cycle, and then that data is written to the other external memory in a write cycle. figures 11.6 to 11.8 show examples of the timing at this time. data buffer address bus data bus address bus data bus memory transfer source module transfer destination module memory transfer source module transfer destination module sar dar data buffer sar dar the sar value is an address, data is read from the transfer source module, and the data is tempolarily stored in the dmac. first bus cycle second bus cycle the dar value is an address and the value stored in the data buffer in the dmac is written to the transfer destination module. dmac dmac figure 11.5 operation of direct address mode in dual address mode
378 (1st cycle) (2nd cycle) data read cycle data write cycle transfer source address transfer destination address ckio a25 to a0 csn d31 to d0 rd wen dackn note: transfer between external memories, dack output in a read cycle dack output timing is the same as that of csn . figure 11.6 example of dma transfer timing in the direct address mode in the dual mode (transfer source: ordinary memory, transfer destination: ordinary memory)
379 transfer source address +4 +8 +12 transfer destination address +4 +8 +12 data read cycle (1st cycle) (2nd cycle) a25 to a0 ckio csn rd wem dackn d31 to d0 note: transfer between external memories, dack output in a read cycle dack output timing is the same as that of csn . figure 11.7 example of dma transfer timing in the direct address mode in the dual mode (16-byte transfer, transfer source: ordinary memory, transfer destination: ordinary memory)
380 transfer source address transfer destination address +4 +8 +12 a25 to a0 ckio csn ras cas rd/ wr dackn d31 to d0 data read cycle (1st cycle) (2nd cycle) data write cycle note: transfer between external memories, dack output in a read cycle dack output timing is the same as that of csn . figure 11.8 example of dma transfer timing in the direct address mode in the dual mode (16-byte transfer, transfer source: synchronous dram, transfer destination: ordinary memory) (2) in the indirect address transfer mode, the address of memory in which data to be transferred is stored is specified in the transfer source address register (sar3) in the dmac. 16-byte transfer is not possible. consequently, in this mode, the address value specified in the transfer source address register in the dmac is read first. this value is temporarily stored in the dmac. next, the read value is output as an address, and the value stored in that address is stored in the dmac again. then, the value read afterwards is written to the address specified in the transfer destination address; this completes one dma transfer. figure 11.7 shows one example. in this example, the transfer destination, the transfer source, and the storage destination of the indirect address are external memories, and transfer data is 16 or 8 bits. figure 11.8 shows an example of the transfer timing. in this mode, one nop cycle (ck1 cycle shown in figure 11.10) is required to output data read as an indirect address to an address bus. if transfer data is 32 bits, third and fourth bus cycles shown in figure 11.10 is required twice for each; a total of six bus cycles and one nop cycle are required.
381 memory transfer source module transfer destination module sar3 dar3 data buffer temporary buffer d m a c when the value in sar3 is an address, the memory data is read and the value is stored in the temporary buffer. the value to be read must be 32 bits since it is used for the address. memory transfer source module data bus address bus transfer destination module sar3 dar3 data buffer temporary buffer d m a c memory transfer source module data bus address bus transfer destination module sar3 dar3 data buffer temporary buffer d m a c first and second bus cycles when the value in the temporary buffer is an address, the data is read from the transfer source module to the data buffer. third bus cycle fourth bus cycle when the value in sar3 is an address, the value in the data buffer is written to the transfer source module. the above description uses the memory, transfer source module, or transfer destination module; in practice, any module can be connected in the addressing space. note: data bus address bus figure 11.9 operation of indirect address in the dual address mode (when the external memory space has a 16-bit width)
382 transfer source address (h) transfer source address (l) indirect address nop transfer destination address indirect address (h) indirect address (l) transfer data transfer data transfer data transfer data transfer data transfer source address ? 1 transfer source address ? 2 indirect address nop indirect address address read cycle (1st) (2nd) (3rd) nop cycle data read cycle (4th) data write cycle ck a25 to a0 csn d31 to d0 internal address bus internal data bus dmac indirect address buffer dmac data buffer rd wen notes: * 1 * 2 the internal address bus value does not change, and controlled by the port. the dmac does not fetch the value until 32-bit data is output to the internal data bus. transfer between external memories figure 11.10 example of transfer timing in the indirect address mode in the dual address mode
383 ? single address mode in single address mode, either the transfer source or transfer destination peripheral device is accessed (selected) by means of the dack signal, and the other device is accessed by address. in this mode, the dmac performs one dma transfer in one bus cycle, accessing one of the external devices by outputting the dack transfer request acknowledge signal to it, and at the same time outputting an address to the other device involved in the transfer. for example, in the case of transfer between external memory and an external device with dack, when the external device outputs data to the data bus, that data is written to the external memory in the same bus cycle. dmac sh7709a dack dreq external address bus external data bus external memory external device with dack data flow figure 11.11 data flow in single address mode two kinds of transfer are possible in single address mode: (1) transfer between an external device with dack and a memory-mapped external device, and (2) transfer between an external device with dack and external memory. in both cases, only the external request signal (dreq) is used for transfer requests. figures 11.12 to 11.14 show examples of dma transfer timing in single address mode.
384 address output to external memory space data output from external device with dack dack signal (active-low) to external device with dack write strobe signal to external memory space address output to external memory space data output from external memory space dack signal (active-low) to external device with dack read strobe signal to external memory space (a) external device with dack external memory space (ordinary memory) (b) external memory space external device with dack (active low) cki0 a25 to a0 d31 to d0 dackn csn we bs cki0 a25 to a0 d31 to d0 dackn csn rd bs figure 11.12 example of dma transfer timing in single address mode
385 ckio a25 to a0 d31 to d0 rd wen dackn csn transfer source address +4 +8 +12 figure 11.13 example of dma transfer timing in single address mode (16-byte transfer; transfer source: external memory space (ordinary memory); transfer destination: external device with dack) bus modes: there are two bus modes: cycle steal and burst. select the mode in the tm bits of chcr0Cchcr3. ? cycle-steal mode in the cycle-steal mode, the bus right is given to another bus master after a one-transfer-unit (8-, 16-, or 32-bit unit) dma transfer. when another transfer request occurs, the bus rights are obtained from the other bus master and a transfer is performed for one transfer unit. when that transfer ends, the bus right is passed to the other bus master. this is repeated until the transfer end conditions are satisfied. in the cycle-steal mode, transfer areas are not affected regardless of settings of the transfer request source, transfer source, and transfer destination. figure 11.14 shows an example of dma transfer timing in the cycle steal mode. transfer conditions shown in the figure are: ? dual address mode ? dreq level detection
386 cpu cpu cpu dmac dmac cpu dmac dmac cpu cpu dreq bus cycle bus right returned to cpu read write write read figure 11.14 transfer example in the cycle-steal mode ? burst mode once the bus right is obtained, the transfer is performed continuously until the transfer end condition is satisfied. in the external request mode with low level detection of the dreq pin, however, when the dreq pin is driven high, the bus passes to the other bus master after the dmac transfer request that has already been accepted ends, even if the transfer end conditions have not been satisfied. the burst mode cannot be used when the serial communications interface (irda and sci) is the transfer request source. figure 11.15 shows a timing at this point. cpu cpu cpu dmac dmac dmac dmac dmac dmac cpu dreq bus cycle read read read write write write figure 11.15 transfer example in the burst mode
387 relationship between request modes and bus modes by dma transfer category: table 11.6 shows the relationship between request modes and bus modes by dma transfer category. table 11.6 relationship of request modes and bus modes by dma transfer category address mode transfer category request mode bus mode transfer size (bits) usable channels dual external device with dack and external memory external b/c 8/16/32/128 0,1 external device with dack and memory-mapped external device external b/c 8/16/32/128 0, 1 external memory and external memory all * 1 b/c 8/16/32/128 0C3 * 5 external memory and memory- mapped external device all * 1 b/c 8/16/32/128 0C3 * 5 memory-mapped external device and memory-mapped external device all * 1 b/c 8/16/32/128 0C3 * 5 external memory and on-chip peripheral module all * 2 b/c * 3 8/16/32 * 4 0C3 * 5 memory-mapped external device and on-chip peripheral module all * 2 b/c * 3 8/16/32 * 4 0C3 * 5 on-chip peripheral module and on- chip peripheral module all * 2 b/c * 3 8/16/32 * 4 0C3 * 5 single external device with dack and external memory external b/c 8/16/32/128 0, 1 external device with dack and memory-mapped external device external b/c 8/16/32/128 0, 1 b: burst, c: cycle steal notes: * 1 external requests, auto requests and on-chip peripheral module requests are all available. for on-chip peripheral module requests, however, irda, sci, and a/d converter cannot be specified as the transfer request source. * 2 external requests, auto requests and on-chip peripheral module requests are all available. when the irda, sci, or a/d converter is also the transfer request source, however, the transfer destination or transfer source must be the irda, sci, or a/d converter, respectively. * 3 if the transfer request source is the irda or sci, the cycle-steal mode is only available. * 4 the access size permitted when the transfer destination or source is an on-chip peripheral module register. * 5 if the transfer request is an external request, channels 0 and 1 are only available. * 6 if the transfer request source is the dram or sdram, the transfer size should be set smaller than the bus width.
388 bus mode and channel priority order: when a given channel 1 is transferring in burst mode and there is a transfer request to a channel 0 with a higher priority, the transfer of channel 0 will begin immediately. at this time, if the priority is set in the fixed mode (ch0 > ch1), the channel 1 transfer will continue when the channel 0 transfer has completely finished, even if channel 0 is operating in the cycle steal mode or in the burst mode. if the priority is set in the round-robin mode, channel 1 will begin operating again after channel 0 completes the transfer of one transfer unit, even if channel 0 is in the cycle steal mode or in the burst mode. the bus will then switch between the two in the order channel 1, channel 0, channel 1, channel 0. even if the priority is set in the fixed mode or in the round-robin mode, it will not give the bus to the cpu since channel 1 is in the burst mode. this example is illustrated in figure 11.16. cpu dmac ch1 dmac ch1 dmac ch0 dmac ch1 dmac ch0 dmac ch1 dmac ch1 cpu ch0 ch1 ch0 round-robin mode in dmac ch0 and ch1 dmac ch1 burst mode cpu cpu priority: round-robin mode ch0: cycle-steal mode ch1: burst mode dmac ch1 burst mode figure 11.16 bus state when multiple channels are operating 11.3.5 number of bus cycle states and dreq pin sampling timing number of bus cycle states: when the dmac is the bus master, the number of bus cycle states is controlled by the bus state controller (bsc) in the same way as when the cpu is the bus master. for details, see section 13, bus state controller (bsc). dreq pin sampling timing: in external request mode, the dreq pin is sampled by clock pulse (ckio) falling edge or low level detection. when dreq input is detected, a dmac bus cycle is generated and dma transfer performed, at the earliest, three states later. the second and subsequent dreq sampling operations are started two cycles after the first sample.
389 operation ? cycle-steal mode in cycle-steal mode, the dreq sampling timing is the same regardless of whether level or edge detection is used. for example, in figure 11.17 (cycle-steal mode, level detection), dmac transfer begins, at the earliest, three cycles after the first sampling is performed. the second sampling is started two cycles after the first. if dreq is not detected at this time, sampling is performed in each subsequent cycle. thus, dreq sampling is performed one step in advance. the third sampling operation is not performed until the idle cycle following the end of the first dma transfer. the above conditions are the same whatever the number of cpu transfer cycles, as shown in figure 11.18, and whatever the number of dma transfer cycles, as shown in figure 11.19. dack is output in a read in the example in figure 11.17, and in a write in the example in figure 11.18. in both cases, dack is output for the same duration as csn . figure 11.20 illustrates the case where dreq is not detected and sampling is subsequently executed every cycle. figure 11.21 shows an example of edge detection in cycle-steal mode. ? burst mode, level detection in the case of burst mode with level detection, the dreq sampling timing is the same as in the cycle-steal mode. for example, in figure 11.22, dmac transfer begins, at the earliest, three cycles after the first sampling is performed. the second sampling is started two cycles after the first. subsequent sampling operations are performed in the idle cycle following the end of the dma transfer cycle. in the burst mode, also, the dack output period is the same as in the cycle-steal mode. ? burst mode, edge detection in the case of burst mode with edge detection, dreq sampling is only performed once. for example, in figure 11.23, dmac transfer begins, at the earliest, three cycles after the first sampling is performed. after this, dmac transfer is executed continuously until the number of data transfers set in the dmatcr register have been completed. dreq is not sampled during this time.
390 to restart dma transfer after it has been suspended by an nmi, first clear nmif, then input an edge request again. in the burst mode, also, the dack output period is the same as in the cycle-steal mode. ckio drak dreq dack bus cycle dmac(r) cpu dmac(w) dmac(r) cpu dmac(w) 1st sampling 2nd sampling 3rd sampling figure 11.17 cycle-steal mode, level input (cpu access: 2 cycles)
391 cpu cpu ckio drak dreq dack dmac(r) dmac(w) dmac(r) 1st sampling 2nd sampling 3rd sampling bus cycle figure 11.18 cycle-steal mode, level input (cpu access: 3 cycles)
392 ckio drak (high output) bus cycle dreq dack (rd output) dmac(w) cpu dmac(w) dmac(r) cpu 1st sampling 2nd sampling 3rd sampling figure 11.19 cycle-steal mode, level input (cpu access: 2 cycles, dma rd access: 4 cycles)
393 ckio drak bus cycle dreq dack (rd output) cpu cpu dmac(w) dmac(r) dmac(w) dmac(r) cpu 3rd sampling is performed, but since dreq is high, per-cycle sampling starts 2nd sampling is performed, but since dreq is high, per-cycle sampling starts 1st sampling 2nd sampling 3rd sampling figure 11.20 cycle-steal mode, level input (cpu access: 2 cycles, dreq input delayed)
394 ckio drak bus cycle dreq dack (rd output) cpu cpu dmac(w) dmac(r) dmac(w) dmac(r) cpu high high high high 2nd sampling is performed, but since there is no dreq falling edge, per-cycle sampling starts 3rd sampling is performed, but since there is no dreq falling edge, per-cycle sampling starts 1st sampling 2nd sampling 3rd sampling note: when a dreq falling edge is detected, dreq must be high for at least one cycle before the sampling point. figure 11.21 cycle-steal mode, edge input (cpu access: 2 cycles)
395 ckio drak dreq dack bus cycle dmac(r) dmac(w) dmac(r) dmac(w) dmac(r) cpu 1st sampling 2nd sampling 3rd sampling figure 11.22 burst mode, level input
396 ckio drak dreq dack bus cycle cpu dmac(r) dmac(w) dmac(r) dmac(w) dmac(r) 1st sampling figure 11.23 burst mode, edge input
397 11.3.6 source address reload function channel 2 includes a reload function, in which the value returns to the value set in the source address register (sar2) for each four transfers by setting the ro bit in chcr2. 16-byte transfer cannot be used. figure 11.24 shows this operation. figure 11.25 shows the timing chart of the source address reload function, which is under the following conditions: burst mode, auto request, 16-bit transfer data size, sar2 count-up, dar2 fixed, reload function on, and usage of only channel 2. sar2 (initial value) dmac transfer request dmac control reload control 4 time count chcr2 dmatcr2 sar2 ro bit = 1 count signal reload signal reload signal address bus figure 11.24 source address reload function diagram
398 ck internal address bus internal data bus sar2 dar2 dar2 dar2 dar2 sar2+2 sar2+4 sar2+6 sar2 sar2 data sar2+2 data sar2+4 data sar2+6 data first transfer of channel 2 second transfer third transfer fourth transfer fifth transfer sar2 output dar2 output sar2+2 output dar2 output sar2+4 output dar2 output sar2+6 output dar2 output sar2 reload sar2 output dar2 output figure 11.25 timing chart of source address reload function even if the transfer data size is 8, 16, or 32 bits, a reload function can be executed. dmatcr2, which specifies a transfer count, increments 1 each time a transfer ends regardless of whether a reload function is on or off. consequently, be sure to specify the value multiple of four in dmatcr2 when the reload function is on. specifying other values does not guarantee the operation. though the counters that count transfers of four times for the reload function are reset by clearing the dme bit in dmaor or the de bit in chcr2, by setting the transfer end flag (te bit in chcr2), by inputting nmi, besides by reset or standby, the sar2, dar2, dmatcr2 registers are not reset. therefore, if these sources are generated, the counters that are initialized and are not initialized exist in the dmac; malfunction will be caused by restarting the dmac in that state. consequently, if these sources occur except for setting the te bit during the usage of the reload function, set sar2, dar2, and dmatcr2 again.
399 11.3.7 dma transfer ending conditions the dma transfer ending conditions vary for individual channels ending and all channels ending together. at transfer end, the following conditions are applied except the case where the value set in the dma transfer count register (dmatcr) reaches 0. (a) cycle-steal mode (external request, internal request, and auto request) when the transfer ending conditions are satisfied, dmac transfer request acceptance is suspended. the dmac stops operating after completing the number of transfers that it has accepted until the ending conditions are satisfied. in the cycle-steal mode, the operation is the same regardless of whether the transfer request is detected by the level or at the edge. (b) burst mode, edge detection (external request, internal request, and auto request) the timing from the point where the ending conditions are satisfied to the point where the dmac stops operating does not differ from that in cycle steal mode. in the edge detection in the burst mode, though only one transfer request is generated to start up the dmac, stop request sampling is performed in the same timing as transfer request sampling in the cycle- steal mode. as a result, the period when stop request is not sampled is regarded as the period when transfer request is generated, and after performing the dma transfer for this period, the dmac stops operating. (c) burst mode, level detection (external request) same as described in (a). (d) bus timing when transfers are suspended the transfer is suspended when one transfer ends. even if transfer ending conditions are satisfied during read in the direct address transfer in the dual address mode, the subsequent write process is executed, and after the transfer in (a) to (c) above has been executed, dmac operation suspends.
400 individual channel ending conditions: there are two ending conditions. a transfer ends when the value of the channels dma transfer count register (dmatcr) is 0, or when the de bit of the channels chcr is cleared to 0. ? when dmatcr is 0: when the dmatcr value becomes 0 and the corresponding channel's dma transfer ends, the transfer end flag bit (te) is set in the chcr. if the ie (interrupt enable) bit has been set, a dmac interrupt (dei) is requested to the cpu. this transfer ending does not apply to (a) to (d) described above. ? when de of chcr is 0: software can halt a dma transfer by clearing the de bit in the channels chcr. the te bit is not set when this happens. this transfer ending applies to (a) to (d) described above. conditions for ending all channels simultaneously: transfers on all channels end when 1) the nmif (nmi flag) bit is set to 1 in the dmaor, or 2) when the dme bit in the dmaor is cleared to 0. ? transfers ending when the nmif bit is set to 1 in dmaor: when an nmi interrupt occurs, the nmif bit is set to 1 in the dmaor and all channels stop their transfers according to the conditions in (a) to (d) described above, and pass the bus right to other bus masters. consequently, even if the nmi bit is set to 1 during transfer, the sar, dar, dmatcr are updated. the te bit is not set. to resume the transfers after nmi interrupt exception processing, clear the nmif bit to 0. at this time, if there are channels that should not be restarted, clear the corresponding de bit in the chcr. ? transfers ending when dme is cleared to 0 in dmaor: clearing the dme bit to 0 in the dmaor forcibly aborts the transfers on all channels. the te bit is not set. all channels aborts their transfers according to the conditions in (a) to (d) in 11.3.7 dma transfer ending condition, as in nmi interrupt generation. in this case, the values in sar, dar, and dmatcr are also updated.
401 11.4 compare match timer (cmt) 11.4.1 overview dmac has an on-chip compare match timer (cmt) to generate dma transfer request. the cmt has 16-bit counter. features the cmt has the following features: ? four types of counter input clock can be selected ? one of four internal clocks (p /4, p /8, p /16, p /64) can be selected. ? generate dma transfer request when compare match occurs. block diagram figure 11.26 shows a cmt block diagram. internal bus bus interface control circuit clock selection cmstr cmcsr cmcor comparator cmcnt module bus cmt p /4 p /8 p /16 p /64 cmstr: cmcsr: cmcor: cmcnt: compare match timer start register compare match timer control/status register 0 compare match timer constant register 0 com p are match timer counter 0 figure 11.26 cmt block diagram
402 register configuration table 11.7 summarizes the cmt register configuration. table 11.7 register configuration name abbreviation r/w initial value address access size (bits) compare match timer start register cmstr r/(w) h'0000 h'4000070 (h'a4000070) * 2 8, 16, 32 compare match timer control/status register 0 cmcsr r/(w) * 1 h'0000 h'4000072 (h'a4000072) * 2 8, 16, 32 compare match counter 0 cmcnt r/w h'0000 h'4000074 (h'a4000074) * 2 8, 16, 32 compare match constant register 0 cmcor r/w h'ffff h'4000076 (h'a4000076) * 2 8, 16, 32 notes: these registers are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. 1. the only value that can be written to cmf bits in cmcsr is a 0 to clear the flags. 2. when address translation by the mmu does not apply, the address in parentheses should be used. 11.4.2 register descriptions compare match timer start register (cmstr) the compare match timer start register (cmstr) is a 16-bit register that selects whether to operate or halt the channel 0 and channel 1 counters (cmcnt). it is initialized to h'0000 by resets. it retains its previous value in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 str0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bits 15 to 2reserved: these bits are always read as 0. the write value should always be 0.
403 bit 1reserved: this bit can be read or written. write 0 when writing. bit 0count start 0 (str0): selects whether to operate or halt compare match timer counter 0. bit 0: str0 description 0 cmcnt count operation halted (initial value) 1 cmcnt count operation compare match timer control/status register (cmcsr) the compare match timer control/status register (cmcsr) is a 16-bit register that indicates the occurrence of compare matches, sets the enable/disable of interrupts, and establishes the clock used for incrementation. it is initialized to h'0000 by resets. it retains its previous value in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 cmf cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/w r r r r r/w r/w note: * the only value that can be written is 0 to clear the flag. bits 15 to 8 and 5 to 2reserved: these bits always read as 0 and cannot be modified. bit 7compare match flag (cmf): this flag indicates whether or not the compare match timer counter 0 (cmcnt) and compare match timer constant register 0 (cmcor) values have matched. bit 7: cmf description 0 cmcnt and cmcor values have not matched (initial value) clear condition: write 0 to cmf after reading cmf = 1 1 cmcnt and cmcor values have matched
404 bit 6 reserved: this bit can be read or written. write 0 when writing. bits 1 and 0clock select 1 and 0 (cks1, cks0): these bits select the clock input to the cmcnt from among the four internal clocks obtained by dividing the system clock (p ). when the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the clock selected by cks1 and cks0. bit 1: cks1 bit 0: cks0 description 00p /4 (initial value) 1p /8 1 0 p /16 1p /64 compare match counter 0 (cmcnt) the compare match counter 0 (cmcnt) is a 16-bit register used as an up-counter. when an internal clock is selected with the cks1 and cks0 bits of the cmcsr register and the str bit of the cmstr is set to 1, the cmcnt begins incrementing with that clock. when the cmcnt value matches that of the compare match constant register 0 (cmcor), the cmcnt is cleared to h'0000 and the cmf flag of the cmcsr is set to 1. the cmcnt is initialized to h'0000 by resets. it retains its previous value in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
405 compare match constant register 0 (cmcor) the compare match constant register 0 (cmcor) is a 16-bit register that sets the compare match period with the cmcnt. the cmcor is initialized to h'ffff by resets. it retains its previous value in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 11.4.3 operation period count operation when an internal clock is selected with the cks1, cks0 bits of the cmcsr register and the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the selected clock. when the cmcnt counter value matches that of the cmcor, the cmcnt counter is cleared to h'0000 and the cmf flag of the cmcsr register is set to 1. the cmcnt counter begins counting up again from h'0000. figure 11.27 shows the compare match counter operation. counter cleared by cmcor compare match cmcnt value cmcor h'0000 time figure 11.27 counter operation
406 cmcnt count timing one of four clocks (p /4, p /8, p /16, p /64) obtained by dividing the clock (p ) can be selected by the cks1 and cks0 bits of the cmcsr. figure 11.28 shows the timing. n+1 ck internal clock cmcnt input clock cmcnt n-1 n figure 11.28 count timing 11.4.4 compare match compare match flag set timing the cmf bit of the cmcsr register is set to 1 by the compare match signal generated when the cmcor register and the cmcnt counter match. the compare match signal is generated upon the final state of the match (timing at which the cmcnt counter matching count value is updated). consequently, after the cmcor register and the cmcnt counter match, a compare match signal will not be generated until a cmcnt counter input clock occurs. figure 11.29 shows the cmf bit set timing.
407 ck cmcor cmcnt input clock compare match signal cmf cmi cmcnt n n 0 figure 11.29 cmf set timing compare match flag clear timing the cmf bit of the cmcsr register is cleared by writing 0 to it after reading 1. figure 11.30 shows the timing when the cmf bit is cleared by the cpu. ck cmf cmcsr write cycle t 1 t 2 figure 11.30 timing of cmf clear by the cpu
408 11.5 examples of use 11.5.1 example of dma transfer between on-chip irda and external memory in this example, receive data of on-chip irda is transferred to external memory using dmac channel 3. table 11.8 shows the transfer conditions and register settings. in addition, it is recommended that the trigger of the number of receive fifo data in irda is set to 1 (rtrg1 = rtrg0 = 0 in scfcr). table 11.8 transfer conditions and register settings for transfer between on-chip sci and external memory transfer conditions register setting transfer source: rdr1 of on-chip irda sar3 h'0400014a transfer destination: external memory dar3 h'00400000 number of transfers: 64 dmatcr3 h'00000040 transfer source address: fixed chcr3 h'00004b05 transfer destination address: incremented transfer request source: irda (rxi1) bus mode: cycle steal transfer unit: byte interrupt request generated at end of transfer channel priority order: 0 > 2 > 3 > 1 dmaor h'0101
409 11.5.2 example of dma transfer between ad0 and external memory (address reload on) in this example, dma transfer is performed between the on-chip a/d converter (transfer source) and the external memory (transfer destination) with address reload function on. table 11.9 shows the transfer conditions and register settings. table 11.9 transfer conditions and register settings for transfer between on-chip a/d converter and external memory transfer conditions register setting transfer source: on-chip a/d converter sar2 h'04000080 transfer destination: external memory dar2 h'00400000 number of transfers: 128 (reloading 32 times) dmatcr2 h'00000080 transfer source address: incremented chcr2 h'00089e35 transfer destination address: decremented transfer request source: a/d converter bus mode: burst transfer unit: long word interrupt request generated at end of transfer channel priority order: 0 > 2 > 3 > 1 dmaor h'0101 when the address reload function is on, the value set in sar returns to the initially set value at each four transfers. in this example, when an interrupt request is generated from a/d converter, byte data is read from the register in address h'04000080 in a/d converter , and it is written to external memory address h'00400000. since longword data has been transferred, the values in sar and dar are h'04000084 and h'003ffffc, respectively. the bus right is maintained and data transfers are successively performed because this transfer is in the burst mode. after four transfers end, fifth and sixth transfers are performed if the address reload function is off, and the value in sar is incremented from h'0400008c, h'04000090, h'04000094,.... if the address reload function is on, the dma transfer stops after the fourth transfer ends, the bus request signal to the cpu is cleared. at this time, the value stored in sar is not incremented from h'0400008c to h'04000090, but returns to the initially set value h'04000080. the value in dar continues being incremented regardless of whether the address reload function is on or off.
410 as a result, the values in the dmac are as shown in table 11.10 when the fourth transfer ends, depending on whether the address reload function is on or off. table 11.10 values in the dmac after the fourth transfer ends items address reload on address reload off sar h'04000080 h'04000090 dar h'003ffffc h'003ffffc dmatcr h'0000007c h'0000007c bus right released held dmac operation stops keeps operating interrupt not generated not generated transfer request source flag clear executed not executed notes: 1. an interrupt is generated regardless of whether the address reload function is on or off, if transfers are executed until the value in dmatcr reaches 0 and the ie bit in chcr has been set to 1. 2. the transfer request source flag is cleared regardless of whether the address reload function is on or off, if transfers are executed until the value in dmatcr reaches 0. 3. specify the burst mode to use the address reload function. this function may not be correctly executed in the cycle steal mode. 4. set the value multiple of four in dmatcr to use the address reload function. this function may not be correctly executed if other values are specified. 11.5.3 example of dma transfer between external memory and scif transmitter (indirect address on) in this example, dma transfer is performed between the external memory specified with the indirect address (transfer source) and the scif transmitter (transfer destination) using dmac channel 3. table 11.11 shows the transfer conditions and register settings. in addition, the trigger of the number of transmit fifo data is set to 1 (ttrg1 = ttrg0 = 1 in scfcr).
411 table 11.11 transfer conditions and register settings for transfer between external memory and scif transmitter transfer conditions register setting transfer source: external memory sar3 h'00400000 value stored in address h'00400000 h'00450000 value stored in address h'04500000 h'55 transfer destination: on-chip scif tdr2 dar3 h'04000156 number of transfers: 10 dmatcr3 h'0000000a transfer source address: incremented chcr3 h'00011c01 transfer destination address: fixed transfer request source: scif (txi2) bus mode: cycle steal transfer unit: byte no interrupt request generated at end of transfer channel priority order: 0 > 1 > 2 > 3 dmaor h'0001 if the indirect address is on, data stored in the address set in sar is not used as transfer source data. in the indirect address, after the value stored in the address set in sar is read, that read value is used as an address again, and the value stored in that address is read and stored in the address set in dar. in the example shown in table 11.11, when an scif transfer request is generated, the dmac reads the value in address h'00400000 set in sar3. since the value h'00450000 is stored in that address, the dmac reads the value h'00450000. next, the dmac uses that read value as an address again, and reads the value h'55 stored in that address. then, the dmac writes the value h'55 to address h'04000156 set in dar3; this completes one indirect address transfer. in the indirect address, when data is read first from the address set in sar3, the data transfer size is always longword regardless of the settings of the ts0 and the ts1 bits that specify the transfer data size. however, whether the transfer source address is fixed, incremented, or decremented is specified according to the sm0 and the sm1 bits. therefore, in this example, though the transfer data size is specified as byte, the value in sar3 is h'00400004 when one transfer ends. write operation is the same as that in the normal dual address transfer. 11.6 cautions 1. the dma channel control registers (chcr0Cchcr3) can be accessed in any data size. the dma operation register (dmaor) must be accessed in byte (eight bits) or word (16 bits); other registers must be accessed in word (16 bits) or longword (32 bits).
412 2. before rewriting the rs0Crs3 bits of chcr0Cchcr3, first clear the de bit to 0 (when rewriting chcr with a byte address, be sure to set the de bit to 0 in advance). 3. even when the nmi interrupt is input when the dmac is not operating, the nmif bit of the dmaor will be set. 4. when entering the standby mode, the dme bit in dmaor must be cleared to 0 and the transfers accepted by the dmac must end. 5. the on-chip peripherals which dmac can access are irda, scif, a/d converter, d/a converter, and i/o ports. do not access the other peripherals by dmac. 6. when starting up the dmac, set chcr or dmaor last. specifying other registers last does not guarantee normal operation. 7. even if the maximum number of transfers is performed in the same channel after the dmatcr count reaches 0 and the dma transfer ends normally, write 0 to dmatcr. otherwise, normal dma transfer may not be performed. 8. when using the address reload function, specify the burst mode as a transfer mode. in the cycle-steal mode, normal dma transfer may not be performed. 9. when using the address reload function, set the value multiple of four in dmatcr. specifying other values does not guarantee normal operation. 10. when detecting an external request at the falling edge, keep the external request pin high when setting the dmac. 11. do not access the space ranging from h'4000062 to h'400006f, which is not used in the dmac. accessing that space may cause malfunctions. 12. in 16-byte transfer, set the slpfrq bit in the frqcr in cpg to 0. 13. in dma 16-byte transfer, transfer may not be performed correctly if the external wait function ( wait pin) is used by the external device at the destination address. a. conditions a1. dmac conditions 16-byte transfer with an external device that uses external waits (e.g. external i/o or pcmcia) selected as the transfer destination by a dmac setting a2. when the number of wait cycles including external waits (waits via the wait pin) exceeds the number set in wcr2 a3. no bsc setting conditions b. preventive measures any of the following three methods can be used to prevent this problem. b1. do not use external waits in the destination space in 16-byte transfer. b2. for condition a1, change from 16-byte transfer to 8/16/32-bit transfer. b3. for condition a2, this problem can be prevented even when using 16-byte transfer, as long as the external wait insertion timing and the external wait assertion time are fixed. the way to prevent this problem when using external wait input is to insert at least as many software waits (waits inserted by means of a wcr2 setting) as external waits.
413 section 12 timer (tmu) 12.1 overview this lsi uses a three-channel (channel 0 to 2) 32-bit timer unit (tmu). 12.1.1 features the tmu has the following features: ? each channel is provided with an auto-reload 32-bit down counter ? channel 2 is provided with an input capture function ? all channels are provided with 32-bit constant registers and 32-bit down counters that can be read or written to at any time ? all channels generate interrupt requests when the 32-bit down counter underflows (h'00000000 h'ffffffff) ? allows selection between 6 counter input clocks: external clock (tclk), on-chip rtc output clock (16 khz), p /4, p /16, p /64, p /256. (p is the internal clock for peripheral modules.) see section 9, on-chip oscillation circuits, for more information on the clock pulse generator. ? all channels can operate when the sh7709a is in standby mode: when the rtc output clock is being used as the counter input clock, the sh7709a is still able to count in standby mode. ? synchronized read: tcnt is a sequentially changing 32-bit register. since the peripheral module used has an internal bus width of 16 bits, a time lag can occur between the time when the upper 16 bits and lower 16 bits are read. to correct the discrepancy in the counter read value caused by this time lag, a synchronization circuit is built into the tcnt so that the entire 32-bit data in the tcnt can be read at once. ? the maximum operating frequency of the 32-bit counter is 2 mhz on all channels: operate the sh7709a so that the clock input to the timer counters of each channel (obtained by dividing the external clock and internal clock with the prescaler) does not exceed the maximum operating frequency.
414 12.1.2 block diagram figure 12.1 shows a block diagram of the tmu. tocr prescaler tstr tcr0 tcnt0 module bus internal bus tcor0 tcr1 tcnt1 tcor1 counter controller tclk p rtcclk tuni0 bus interface ch. 0 interrupt controller interrupt controller interrupt controller counter controller counter controller tuni1 tuni2 ticpi2 tcr2 tcpr2 tcnt2 tcor2 tmu ch. 1 ch. 2 clock controller tocr: tstr: tcr: timer output control register timer start register timer control register tcnt: tcor: tcpr2: 32-bit timer counter 32-bit timer constant register 32-bit input capture register legend: figure 12.1 tmu block diagram
415 12.1.3 pin configuration table 12.1 shows the pin configuration of the tmu. table 12.1 pin configuration channel pin i/o description clock input/clock output tclk i/o external clock input pin/input capture control input pin/realtime clock (rtc) output pin 12.1.4 register configuration table 12.2 shows the tmu register configuration. table 12.2 tmu register configuration channel register abbreviation r/w initial value * address access size common timer output control register tocr r/w h'00 h'fffffe90 8 timer start register tstr r/w h'00 h'fffffe92 8 0 timer constant register 0 tcor0 r/w h'ffffffff h'fffffe94 32 timer counter 0 tcnt0 r/w h'ffffffff h'fffffe98 32 timer control register 0 tcr0 r/w h'0000 h'fffffe9c 16 1 timer constant register 1 tcor1 r/w h'ffffffff h'fffffea0 32 timer counter 1 tcnt1 r/w h'ffffffff h'fffffea4 32 timer control register 1 tcr1 r/w h'0000 h'fffffea8 16 2 timer constant register 2 tcor2 r/w h'ffffffff h'fffffeac 32 timer counter 2 tcnt2 r/w h'ffffffff h'fffffeb0 32 timer control register 2 tcr2 r/w h'0000 h'fffffeb4 16 input capture register 2 tcpr2 r undefined h'fffffeb8 32 note: * initialized by power-on resets or manual resets.
416 12.2 tmu registers 12.2.1 timer output control register (tocr) tocr is an 8-bit read/write register that selects whether to use the external tclk pin as an external clock or an input capture control usage input pin, or an output pin for the on-chip rtc output clock. tocr is initialized to h'00 by a power-on reset or manual reset, but is not initialized in standby mode. bit: 7 6 5 4 3 2 1 0 tcoe initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bits 7 to 1 reserved: these bits are always read as 0. the write value should always be 0. bit 0 timer clock pin control (tcoe): selects use of the timer clock pin (tclk) as an external clock input pin or input pin for input capture control for the on-chip timer, or as an output pin for the on-chip rtc output clock. as the tclk pin is multiplexed as the pth7 pin, when the tclk pin is used, bits ph7md1 and ph7md0 in the phcr register should be set to 00 ("other function" setting). bit 0: tcoe description 0 timer clock pin (tclk) used as external clock input or input capture control input pin for the on-chip timer (initial value) 1 timer clock pin (tclk) used as output pin for on-chip rtc output clock 12.2.2 timer start register (tstr) tstr is an 8-bit read/write register that selects whether to run or halt the timer counters (tcnt) for channels 0 C 2. tstr is initialized to h'00 by a power-on reset or manual reset, but is not initialized in standby mode when the input clock selected for the channel is the on-chip rtc clock (rtcclk). it is initialized in standby mode, changing the multiplying ratio of pll circuit 1 or mstp2 bit in stbcr is set to a logic one only when an external clock (tclk) or the peripheral clock (p ) is used as the input clock. bit: 7 6 5 4 3 2 1 0 str2 str1 str0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/w r/w r/w
417 bits 7 to 3 reserved: these bits are always read 0. the write value should always be 0. bit 2 counter start 2 (str2): selects whether to run or halt timer counter 2 (tcnt2). bit 2: str2 description 0 halt tcnt2 count (initial value) 1 start tcnt2 counting bit 1 counter start 1 (str1): selects whether to run or halt timer counter 1 (tcnt1). bit 1: str1 description 0 halt tcnt1 count (initial value) 1 start tcnt1 counting bit 0 counter start 0 (str0): selects whether to run or halt timer counter 0 (tcnt0). bit 0: str0 description 0 halt tcnt0 count (initial value) 1 start tcnt0 counting 12.2.3 timer control register (tcr) the timer control registers (tcr) control the timer counters (tcnt) and interrupts. the tmu has three tcr registers for each channel. the tcr registers are 16-bit read/write registers that control the issuance of interrupts when the flag indicating timer counter (tcnt) underflow has been set to 1, and also carry out counter clock selection. when the external clock has been selected, they also select its edge. additionally, tcr2 controls the channel 2 input capture function and the issuance of interrupts during input capture. the tcrs are initialized to h'0000 by a power-on reset and manual reset. they are not initialized in standby mode.
418 channel 0 and 1 tcr bit configuration: bit: 15 14 13 12 11 10 9 8 unf initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w channel 2 tcr bit configuration: bit: 15 14 13 12 11 10 9 8 icpf unf initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 icpe1 icpe0 unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 10, 9 (except tcr2), 7, and 6 (except tcr2) reserved: these bits are always read as 0. the write value should always be 0. bit 9 input capture interrupt flag (icpf): a function of channel 2 only: the flag is set when input capture is requested via the tclk pin. bit 9: icpf description 0 no input capture request has been issued. clearing condition: when 0 is written to icpf (initial value) 1 input capture has been requested via the tclk pin. setting condition: when an input capture is requested via the tclk pin * note: * contents do not change when 1 is written to icpf.
419 bit 8 underflow flag (unf): status flag that indicates occurrence of a tcnt underflow. bit 8: unf description 0 tcnt has not underflowed. clearing condition: when 0 is written to unf (initial value) 1 tcnt has underflowed (h'00000000 h'ffffffff). setting condition: when tcnt underflows * note: * contents do not change when 1 is written to unf. bits 7 and 6 input capture control (icpe1, icpe0): a function of channel 2 only: determines whether the input capture function can be used, and when used, whether or not to enable interrupts. when using this input capture function it is necessary to set the tclk pin to input mode with the tcoe bit in the tocr register. additionally, use the ckeg bit to designate use of either the rising or falling edge of the tclk pin to set the value in tcnt2 in the input capture register (tcpr2). bit 7: icpe1 bit 6: icpe0 description 0 0 input capture function is not used. (initial value) 1 reserved (setting disabled) 1 0 input capture function is used. interrupt due to icpf (ticpi2) are not enabled. 1 input capture function is used. interrupt due to icpf (ticpi2) are enabled. bit 5 underflow interrupt control (unie): controls enabling of interrupt generation when the status flag (unf) indicating tcnt underflow has been set to 1. bit 5: unie description 0 interrupt due to unf (tuni) is not enabled. (initial value) 1 interrupt due to unf (tuni) is enabled.
420 bits 4 and 3clock edge 1 and 0 (ckeg1, ckeg0): these bits select the external clock edge when the external clock is selected, or when the input capture function is used. bit 4: ckeg1 bit 3: ckeg0 description 0 0 count/capture register set on rising edge (initial value) 1 count/capture register set on falling edge 1 x count/capture register set on both rising and falling edge note: x means 0, 1, or dont care. bits 2 to 0timer prescalers 2 to 0 (tpsc2 to tpsc0): these bits select the tcnt count clock. bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count on p /4 (initial value) 1 internal clock: count on p / 16 1 0 internal clock: count on p /64 1 internal clock: count on p /256 1 0 0 internal clock: count on clock output of on-chip rtc (rtcclk) 1 external clock: count on tclk pin input 1 0 reserved (setting disabled) 1 reserved (setting disabled) 12.2.4 timer constant register (tcor) the timer constant registers are 32-bit registers. the tmu has three tcor registers, one for each of the three channels. tcor is a 32-bit read/write register. when a tcnt count-down results in an underflow, the tcor value is set in tcnt and the count-down continues from that value. tcor is initialized to h'ffffffff by a power-on reset or manual reset; it is not initialized in standby mode, and retains its contents.
421 bit: 31 30 29 28 27 26 25 24 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 12.2.5 timer counters (tcnt) the timer counters are 32-bit read/write registers. the tmu has three timer counters, one for each channel. tcnt counts down upon input of a clock. the clock input is selected using the tpsc2 C tpsc0 bits in the timer control register (tcr). when a tcnt count-down results in an underflow (h'00000000 h'ffffffff), the underflow flag (unf) in the timer control register (tcr) of the relevant channel is set. the tcor value is simultaneously set in tcnt itself and the count-down continues from that value. because the internal bus for the sh7709a on-chip supporting modules is 16 bits wide, a time lag can occur between the time when the upper 16 bits and lower 16 bits are read. since tcnt counts sequentially, this time lag can create discrepancies between the data in the upper and lower halves. to correct the discrepancy, a buffer register is connected to tcnt so that upper and lower halves are not read separately. the entire 32-bit data in tcnt can thus be read at once. tcnt is initialized to h'ffffffff by a power-on reset or manual reset; it is not initialized in standby mode, and retains its contents.
422 bit: 31 30 29 28 27 26 25 24 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 12.2.6 input capture register (tcpr2) the input capture register (tcpr2) is a read-only 32-bit register built only into timer 2. control of tcpr2 setting conditions due to the tclk pin is affected by the input capture function bits (icpe1/icpe2 and ckeg1/ckeg0) in tcr2. when a tcpr2 setting indication due to the tclk pin occurs, the value of tcnt2 is copied into tcpr2. tcnt2 is not initialized by a power-on reset or manual reset, or in standby mode.
423 bit: 31 30 29 28 27 26 25 24 initial value: r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 initial value: r/w: r r r r r r r r bit: 15 14 13 12 11 10 9 8 initial value: r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 initial value: r/w: r r r r r r r r 12.3 tmu operation 12.3.1 overview each of three channels has a 32-bit timer counter (tcnt) and a 32-bit timer constant register (tcor). the tcnt counts down. the auto-reload function enables synchronized counting and counting by external events. channel 2 has an input capture function. 12.3.2 basic functions counter operation: when the str0 C str2 bits in the timer start register (tstr) are set, the corresponding timer counter (tcnt) starts counting. when a tcnt underflows, the unf flag of the corresponding timer control register (tcr) is set. at this time, if the unie bit in tcr is 1, an interrupt request is sent to the cpu. also at this time, the value is copied from tcor to tcnt and the down-count operation is continued.
424 the count operation is set as follows (figure 12.2): 1. select the counter clock with the tpsc2 C tpsc0 bits in the timer control register (tcr). if the external clock is selected, set the tclk pin to input mode with the toce bit in tocr, and select its edge with the ckeg1 and ckeg0 bits in tcr. 2. use the unie bit in tcr to set whether to generate an interrupt when tcnt underflows. 3. when using the input capture function, set the icpe bits in tcr, including the choice of whether or not to use the interrupt function (channel 2 only). 4. set a value in the timer constant register (tcor) (the cycle is the set value plus 1). 5. set the initial value in the timer counter (tcnt). 6. set the str bit in the timer start register (tstr) to 1 to start operation. select operation select counter clock set underflow interrupt generation set timer constant register initialize timer counter start counting (1) (2) (4) (5) (6) set interrupt generation when using input capture function (3) note: when an interrupt has been generated, clear the flag in the interrupt handler that caused it. if interrupts are enabled without clearing the flag, another interrupt will be generated. figure 12.2 setting the count operation auto-reload count operation: figure 12.3 shows the tcnt auto-reload operation.
425 tcnt value tcor h'00000000 str0Cstr2 unf tcor value set to tcnt during underflow time figure 12.3 auto-reload count operation tcnt count timing: ? internal clock operation: set the tpsc2 C tpsc0 bits in tcr to select whether peripheral module clock p or one of the four internal clocks created by dividing it is used (p /4, p /16, p /64, p /256). figure 12.4 shows the timing. p internal clock tcnt input clock tcnt n + 1 n n C 1 figure 12.4 count timing when internal clock is operating
426 ? external clock operation: set the tpsc2 C tpsc0 bits in tcr to select the external clock (tclk) as the timer clock. use the ckeg1 and ckeg0 bits in tcr to select the detection edge. rise, fall or both may be selected. the pulse width of the external clock must be at least 1.5 peripheral module clock cycles for single edges or 2.5 peripheral module clock cycles for both edges. a shorter pulse width will result in accurate operation. figure 12.5 shows the timing for both-edge detection. p external clock input pin tcnt input clock tcnt n + 1 n n C 1 figure 12.5 count timing when external clock is operating (both edges detected) ? on-chip rtc clock operation: set the tpsc2 C tpsc0 bits in tcr to select the on-chip rtc clock as the timer clock. figure 12.6 shows the timing. rtc output clock tcnt tcnt input clock n + 1 n n C 1 figure 12.6 count timing when on-chip rtc clock is operating input capture function: channel 2 has an input capture function (figure 12.7). when using the input capture function, set the tclk pin to input mode with the tcoe bit in the timer output control register (tocr) and set the timer operation clock to internal clock or on-chip rtc clock with the tpcs2 C tpcs0 bits in the timer control register (tcr2). also, designate use of the input capture function and whether to generate interrupts on using it with the ipce1 C ipce0 bits in tcr2, and designate the use of either the rising or falling edge of the tclk pin to set the timer counter (tcnt2) value into the input capture register (tcpr2) with the ckeg1Cckeg0 bits in tcr2. the input capture function cannot be used in standby mode.
427 tcnt value tcor h'00000000 tclk tcpr2 set tcnt value icpi tcor value set to tcnt during underflow time figure 12.7 operation timing when using the input capture function (using tclk rising edge) 12.4 interrupts there are two sources of tmu interrupts: underflow interrupts (tuni) and interrupts when using the input capture function (ticpi2). 12.4.1 status flag set timing unf is set to 1 when the tcnt underflows. figure 12.8 shows the timing. p tcnt underflow signal unf tuni tcor value h'00000000 figure 12.8 unf set timing
428 12.4.2 status flag clear timing the status flag can be cleared by writing 0 from the cpu. figure 12.9 shows the timing. p peripheral address bus unf tcr address t1 t2 tcr write cycle t3 figure 12.9 status flag clear timing 12.4.3 interrupt sources and priorities the tmu produces underflow interrupts for each channel. when the interrupt request flag and interrupt enable bit are both set to 1, the interrupt is requested. codes are set in the exception event register (intevt, intevt2) for these interrupts and interrupt processing occurs according to the codes. the relative priorities of channels can be changed using the interrupt controller (see section 4, exception processing, and section 6, interrupt controller (intc)). table 12.3 lists tmu interrupt sources. table 12.3 tmu interrupt sources channel interrupt source description priority 0 tuni0 underflow interrupt 0 high 1 tuni1 underflow interrupt 1 2 tuni2 underflow interrupt 2 2 ticpi2 input capture interrupt 2 low
429 12.5 usage notes 12.5.1 writing to registers synchronization processing is not performed for timer counting during register writes. when writing to registers, always clear the appropriate start bits for the channel (str2 C str0) in the timer start register (tstr) to halt timer counting. 12.5.2 reading registers synchronization processing is performed for timer counting during register reads. when timer counting and register read processing are performed simultaneously, the register value before tcnt counting down (with synchronization processing) is read.
430
431 section 13 realtime clock (rtc) 13.1 overview this lsi has a realtime clock (rtc) with its own 32.768-khz crystal oscillator. 13.1.1 features ? clock and calendar functions (bcd display): seconds, minutes, hours, date, day of the week, month, and year ? 1-hz to 64-hz timer (binary display) ? start/stop function ? 30-second adjust function ? alarm interrupt: frame comparison of seconds, minutes, hours, date, day of the week, and month can be used as conditions for the alarm interrupt ? cyclic interrupts: the interrupt cycle may be 1/256 second, 1/64 second, 1/16 second, 1/4 second, 1/2 second, 1 second, or 2 seconds ? carry interrupt: a carry interrupt indicates when a carry occurs during a counter read ? automatic leap year correction 13.1.2 block diagram a block diagram of the rtc is shown in figure 13.1.
432 module bus rtc internal bus interrupt control circuit prescaler ( 2) rtcclk bus interface carry detection circuit ati pri cui r64cnt reset rseccnt rmincnt rhrcnt rwkcnt 16.384 khz rdaycnt rmoncnt ryrcnt comparator rsecar rminar rhrar rwkar rdayar rcr1 rcr2 30- second adj extal2 32.768 khz 128 hz xtal2 externally connected circuit oscillator circuit prescaler ( 128) rmonar r64cnt: rseccnt: rmincnt: rhrcnt: rwkcnt: rdaycnt: rmoncnt: ryrcnt: 64-hz counter second counter minute counter hour counter day of the week counter date counter month counter year counter rsecar: rhrar: rminar: rwkar: rdayar: rmonar: rcr1: rcr2: second alarm register minute alarm register hour alarm register day of the week alarm register date alarm register month alarm register rtc control register 1 rtc control register 2 legend: figure 13.1 rtc block diagram
433 13.1.3 pin configuration table 13.1 shows the rtc pin configuration. table 13.1 rtc pin configuration pin abbreviation i/o description rtc oscillator crystal pin extal2 i connects crystal to rtc oscillator * 2 rtc oscillator crystal pin xtal2 o connects crystal to rtc oscillator * 2 clock input/clock output tclk i/o external clock input pin/input capture control input pin/realtime clock (rtc) output pin (shared by tmu) dedicated power-supply pin for rtc v cc -rtc dedicated power-supply pin for rtc * 1 dedicated gnd pin for rtc v ss -rtc dedicated gnd pin for rtc * 1 note: * 1 power must be supplied to the rtc power supply pins even when the rtc is not used. even if only the rtc is used, power must be supplied to all power supply pins, including these pins. in standby mode, also, power must be supplied to all power supply pins, including these pins. * 2 when the rtc is not used, pull extal2 up (to vcc) and make no connection for xtal2.
434 13.1.4rtc register configuration table 13.2 shows the rtc register configuration. table 13.2 rtc registers name abbreviation r/w initial value address access size 64-hz counter r64cnt r undefined h'fffffec0 8 second counter rseccnt r/w undefined h'fffffec2 8 minute counter rmincnt r/w undefined h'fffffec4 8 hour counter rhrcnt r/w undefined h'fffffec6 8 day of week counter rwkcnt r/w undefined h'fffffec8 8 date counter rdaycnt r/w undefined h'fffffeca 8 month counter rmoncnt r/w undefined h'fffffecc 8 year counter ryrcnt r/w undefined h'fffffece 8 second alarm register rsecar r/w undefined * h'fffffed0 8 minute alarm register rminar r/w undefined * h'fffffed2 8 hour alarm register rhrar r/w undefined * h'fffffed4 8 day of week alarm register rwkar r/w undefined * h'fffffed6 8 date alarm register rdayar r/w undefined * h'fffffed8 8 month alarm register rmonar r/w undefined * h'fffffeda 8 rtc control register 1 rcr1 r/w h'00 h'fffffedc 8 rtc control register 2 rcr2 r/w h'09 h'fffffede 8 note: * only the enb bits of each register are initialized.
435 13.2 rtc registers 13.2.1 64-hz counter (r64cnt) the 64-hz counter (r64cnt) is an 8-bit read-only register that indicates the state of the rtc divider circuit between 64 hz and 1 hz. r64cnt is reset to h'00 by setting the reset bit in rtc control register 2 (rcr2) or the adj bit in rcr2 to 1. r64cnt is not initialized by a power-on reset or manual reset, or in standby mode. bit 7 always reads 0. bit: 7 6 5 4 3 2 1 0 1hz 2hz 4hz 8hz 16hz 32hz 64hz initial value: 0 r/w: r r r r r r r r 13.2.2 second counter (rseccnt) the second counter (rseccnt) is an 8-bit read/write register used for setting/counting in the bcd-coded second section of the rtc. the count operation is performed by a carry for each second of the 64 - hz counter. the range that can be set is 00 C 59 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rseccnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 10 seconds 1 second initial value: 0 r/w: r r/w r/w r/w r/w r/w r/w r/w
436 13.2.3 minute counter (rmincnt) the minute counter (rmincnt) is an 8-bit read/write register used for setting/counting in the bcd-coded minute section of the rtc. the count operation is performed by a carry for each minute of the second counter. the range that can be set is 00C59 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rmincnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 10 minutes 1 minute initial value: 0 r/w: r r/w r/w r/w r/w r/w r/w r/w 13.2.4hour counter (rhrcnt) the hour counter (rhrcnt) is an 8-bit read/write register used for setting/counting in the bcd- coded hour section of the rtc. the count operation is performed by a carry for each 1 hour of the minute counter. the range that can be set is 00 C 23 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rhrcnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 10 hours 1 hour initial value: 0 0 r/w: r r r/w r/w r/w r/w r/w r/w
437 13.2.5 day of the week counter (rwkcnt) the day of the week counter (rwkcnt) is an 8-bit read/write register used for setting/counting in the bcd-coded day of week section of the rtc. the count operation is performed by a carry for each day of the date counter. the range that can be set is 0 C 6 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rwkcnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 day of week initial value: 0 0 0 0 0 r/w: r r r r r r/w r/w r/w days of the week are coded as shown in table 13.3. table 13.3 day-of-week codes (rwkcnt) day of weekcode sunday0 monday1 tuesday2 wednesday3 thursday4 friday5 saturday6
438 13.2.6 date counter (rdaycnt) the date counter (rdaycnt) is an 8-bit read/write register used for setting/counting in the bcd- coded date section of the rtc. the count operation is performed by a carry for each day of the hour counter. the range that can be set is 01 C 31 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rdaycnt is not initialized by a power-on reset or manual reset, or in standby mode. the rdaycnt range that can be set changes with each month and in leap years. please confirm the correct setting. bit: 7 6 5 4 3 2 1 0 10 days 1 day initial value: 0 0 r/w: r r r/w r/w r/w r/w r/w r/w 13.2.7 month counter (rmoncnt) the month counter (rmoncnt) is an 8-bit read/write register used for setting/counting in the bcd-coded month section of the rtc. the count operation is performed by a carry for each month of the date counter. the range that can be set is 00 C 12 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rmoncnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 10 months 1 month initial value: 0 0 0 r/w: r r r r/w r/w r/w r/w r/w
439 13.2.8 year counter (ryrcnt) the year counter (ryrcnt) is an 8-bit read/write register used for setting/counting in the bcd- coded year section of the rtc. the least significant 2 digits of the western calendar year are displayed. the count operation is performed by a carry for each year of the month counter. the range that can be set is 00 C 99 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2 or using a carry flag as shown in figure 13.2. ryrcnt is not initialized by a power-on reset or manual reset, or in standby mode. leap years are recognized by dividing the year counter value by 4 and obtaining a fractional result of 0. bit: 7 6 5 4 3 2 1 0 10 years 1 year initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w 13.2.9 second alarm register (rsecar) the second alarm register (rsecar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded second section counter rseccnt of the rtc. when the enb bit is set to 1, a comparison with the rseccnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 00 C 59 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rsecar is initialized to 0 by a power-on reset. the remaining rsecar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 enb 10 seconds 1 second initial value: 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
440 13.2.10 minute alarm register (rminar) the minute alarm register (rminar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded minute section counter rmincnt of the rtc. when the enb bit is set to 1, a comparison with the rmincnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 00 C 59 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rminar is initialized by a power-on reset. the remaining rminar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 enb 10 minutes 1 minute initial value: 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 13.2.11 hour alarm register (rhrar) the hour alarm register (rhrar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded hour section counter rhrcnt of the rtc. when the enb bit is set to 1, a comparison with the rhrcnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 00 C 23 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rhrar is initialized by a power-on reset. the remaining rhrar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 enb 10 hours 1 hour initial value: 0 0 r/w: r/w r r/w r/w r/w r/w r/w r/w
441 13.2.12 day of the week alarm register (rwkar) the day of the week alarm register (rwkar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded day of week section counter rwkcnt of the rtc. when the enb bit is set to 1, a comparison with the rwkcnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 0 C 6 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rwkar is initialized by a power-on reset. the remaining rwkar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 enb day of week initial value: 0 0 0 0 0 r/w: r/w r r r r r/w r/w r/w days of the week are coded as shown in table 13.4. table 13.4day-of-week codes (rwkar) day of weekcode sunday0 monday1 tuesday2 wednesday3 thursday4 friday5 saturday6
442 13.2.13 date alarm register (rdayar) the date alarm register (rdayar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded date section counter rdaycnt of the rtc. when the enb bit is set to 1, a comparison with the rdaycnt value is performed. from among the registers rsecar, rminar, rhrar, rwkar, rdayar, rmonar, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 01 C 31 (decimal) + enb bit. errant operation will result if any other value is set. the rdaycnt range that can be set changes with some months and in leap years. please confirm the correct setting. the enb bit in rdayar is initialized by a power-on reset. the remaining rdayar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 enb 10 days 1 day initial value: 0 0 r/w: r/w r r/w r/w r/w r/w r/w r/w 13.2.14month alarm register (rmonar) the month alarm register (rmonar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded month section counter rmoncnt of the rtc. when the enb bit is set to 1, a comparison with the rmoncnt value is performed. from among the registers rsecar, rminar, rhrar, rwkar, rdayar, rmonar, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 01 C 12 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rmonar is initialized by a power-on reset. the remaining rmonar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 enb 10 months 1 month initial value: 0 0 0 r/w: r/w r r r/w r/w r/w r/w r/w
443 13.2.15 rtc control register 1 (rcr1) the rtc control register 1 (rcr1) is an 8-bit read/write register that affects carry flags and alarm flags. it also selects whether to generate interrupts for each flag. because flags are sometimes set after an operand read, do not use this register in read-modify-write processing. rcr1 is initialized to h'00 by a power-on reset. in a manual reset, all bits are initialized to 0 except for the cf flag, which is undefined. when using the cf flag, it must be initialized beforehand. this register is not initialized in standby mode. bit: 7 6 5 4 3 2 1 0 cf cie aie af initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r r/w r/w r r r/w bit 7 carry flag (cf): status flag that indicates that a carry has occurred. cf is set to 1 when a count-up to r64cnt or rseccnt occurs. a count register value read at this time cannot be guaranteed; another read is required. bit 7: cf description 0 no count up of r64cnt or rseccnt. clearing condition: when 0 is written to cf (initial value) 1 count up of r64cnt or rseccnt. setting condition: when 1 is written to cf bits 6, 5, 2, and 1 reserved: these bits are always read as 0. the write value should always be 0. bit 4 carry interrupt enable flag (cie): when the carry flag (cf) is set to 1, the cie bit enables interrupts. bit 4: cie description 0 a carry interrupt is not generated when the cf flag is set to 1 (initial value) 1 a carry interrupt is generated when the cf flag is set to 1
444 bit 3 alarm interrupt enable flag (aie): when the alarm flag (af) is set to 1, the aie bit allows interrupts. bit 3: aie description 0 an alarm interrupt is not generated when the af flag is set to 1 (initial value) 1 an alarm interrupt is generated when the af flag is set to 1 bit 0 alarm flag (af): the af flag is set to 1 when the alarm time set in an alarm register (only registers with enb bit set to 1) matches the clock and calendar time. this flag is cleared to 0 when 0 is written, but holds the previous value when 1 is to be written. bit 0: af description 0 clock/calendar and alarm register have not matched since last reset to 0. clearing condition: when 0 is written to af (initial value) 1 setting condition: clock/calendar and alarm register have matched (only registers with enb set) * note: * contents do not change when 1 is written to af. 13.2.16 rtc control register 2 (rcr2) the rtc control register 2 (rcr2) is an 8-bit read/write register for periodic interrupt control, 30- second adjustment adj, divider circuit reset, and rtc count start/stop control. it is initialized to h'09 by a power-on reset. it is initialized except for rtcen and start by a manual reset. it is not initialized in standby mode, and retains its contents. bit: 7 6 5 4 3 2 1 0 pef pes2 pes1 pes0 rtcen adj reset start initial value: 0 0 0 0 1 0 0 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7 periodic interrupt flag (pef): indicates interrupt generation with the period designated by the pes bits. when set to 1, pef generates periodic interrupts. bit 7: pef description 0 interrupts not generated with the period designated by the pes bits. clearing condition: when 0 is written to pef (initial value) 1 interrupts generated with the period designated by the pes bits. setting condition: when 1 is written to pef
445 bits 6 to 4periodic interrupt flags (pes2 to pes0): these bits specify the periodic interrupt. bit 6: pes2 bit 5: pes1 bit 4: pes0 description 0 0 0 no periodic interrupts generated (initial value) 1 periodic interrupt generated every 1/256 second 1 0 periodic interrupt generated every 1/64 second 1 periodic interrupt generated every 1/16 second 1 0 0 periodic interrupt generated every 1/4 second 1 periodic interrupt generated every 1/2 second 1 0 periodic interrupt generated every 1 second 1 periodic interrupt generated every 2 seconds bit 3 rtcen: controls the operation of the crystal oscillator for the rtc. bit 3: rtcen description 0 halts the crystal oscillator for the rtc. 1 runs the crystal oscillator for the rtc. (initial value) bit 2 30 second adjustment (adj): when 1 is written to the adj bit, times of 29 seconds or less will be rounded to 00 seconds and 30 seconds or more to 1 minute. the divider circuit will be simultaneously reset. this bit always reads 0. bit 2: adj description 0 runs normally. (initial value) 1 (write) 30-second adjustment. bit 1 reset (reset): when 1 is written, initializes the divider circuit (rtc prescaler and r64cnt). this bit always reads 0. bit 1: reset description 0 runs normally. (initial value) 1 (write) divider circuit is reset.
446 bit 0 start bit (start): halts and restarts the counter (clock). bit 0: start description 0 second/minute/hour/day/week/month/year counter halts. 1 second/minute/hour/day/week/month/year counter runs normally. (initial value) note: the 64-hz counter always runs unless stopped with the rtcen bit. 13.3 rtc operation 13.3.1 initial settings of registers after power-on all the registers should be set after the power is turned on. 13.3.2 setting the time figure 13.2 shows how to set the time when the clock is stopped. this works when the entire calendar or clock is to be set. write 1 to reset and 0 to start in the rcr2 register order is irrelevant write 1 to start in the rcr2 register set seconds, minutes, hour, day, day of the week, month and year stop clock, reset divider circuit to reset the divider circuit (rtc prescaler and r64cnt) and set the counter start clock figure 13.2 setting the time
447 13.3.3 reading the time figure 13.3 shows how to read the time. if a carry occurs while reading the time, the correct time will not be obtained, so it must be read again. part (a) in figure 13.3 shows the method of reading the time without using interrupts; part (b) in figure 13.3 shows the method using carry interrupts. to keep programming simple, method (a) should normally be used. write 0 to cie in rcr1 note: set af to 1 so that alarm flag is not cleared. read rcr1 and check cf write 0 to cie in rcr1 carry flag = 1? no yes clear the carry flag disable the carry interrupt read counter register write 1 to cie in rcr1, and write 0 to cf in rcr1 note: set af in rcr1 to 1 so that alarm flag is not cleared. interrupt generated? no yes enable the carry interrupt clear the carry flag disable the carry interrupt read counter register to read the time without using interrupts b. to use interrupts a. figure 13.3 reading the time
448 13.3.4alarm function figure 13.4 shows how to use the alarm function. alarms can be generated using seconds, minutes, hours, day of the week, date, month, or any combination of these. set the enb bit (bit 7) in the register on which the alarm is placed to 1, and then set the alarm time in the lower bits. clear the enb bit in the register on which the alarm is placed to 0. when the clock and alarm times match, 1 is set in the af bit (bit 0) in rcr1. alarm detection can be checked by reading this bit, but normally it is done by interrupt. if 1 is placed in the aie bit (bit 3) in rcr1, an interrupt is generated when an alarm occurs. when using interrupts, the interrupt enable bit (bit 3 of rcr1) is 1 clock running set alarm time set whether to use alarm interrupt always set, since the flag may have been set while the alarm time was being set. write 0 to bit 0 of rcr1 to clear it. clear alarm flag monitor alarm time (wait for interrupt or check alarm flag) figure 13.4 using the alarm function
449 13.3.5 crystal oscillator circuit crystal oscillator circuit constants (recommended values) are shown in table 13.5, and the rtc crystal oscillator circuit in figure 13.5. table 13.5 recommended oscillator circuit constants (recommended values) fosc cin cout 32.768 khz 10 to 22 pf 10 to 22 pf sh7709a extal2 xtal2 xtal c in c out r f r d notes: 1. select either the c in or c out side for frequency adjustment variable capacitor according to requirements such as frequency range, degree of stability, etc. 2. built-in resistance value r f (typ value) = 10 m ? , r d (typ value) = 400 k ? 3. c in and c out values include floating capacitance due to the wiring. take care when using a ground plane. 4. the crystal oscillation settling time depends on the mounted circuit constants, floating capacitance, etc., and should be decided after consultation with the crystal resonator manufacturer. 5. place the crystal resonator and load capacitors c in and c out as close as possible to the chip. (correct oscillation may not be possible if there is externally induced noise in the extal2 and xtal2 pins.) 6. ensure that the crystal resonator connection pin (extal2, xtal2) wiring is routed as far away as possible from other power lines (except gnd) and signal lines. figure 13.5 example of crystal oscillator circuit connection
450 13.4usage notes 13.4.1 register writing during rtc count the following rtc registers cannot be written to during an rtc count (while bit 0 = 1 in rcr2). rseccnt, rmincnt, rhrcnt, rdaycnt, rwkcnt, rmoncnt, ryrcnt the rtc count must be halted before writing to any of the above registers. 13.4.2 use of realtime clock (rtc) periodic interrupts the method of using the periodic interrupt function is shown in figure 13.6. a periodic interrupt can be generated periodically at the interval set by the periodic interrupt enable flag (pes) in rtc control register 2 (rcr2). when the time set by the periodic interrupt enable flag (pes) has elapsed, the periodic interrupt flag (pef) is set to 1. the periodic interrupt flag (pef) is cleared to 0 upon periodic interrupt generation when the periodic interrupt enable flag (pes) is set. periodic interrupt generation can be confirmed by reading this bit, but normally the interrupt function is used. set pes, and clear pef to 0, in rcr2 clear pef to 0 set pes, clear pef elapse of time set by pes clear pef figure 13.6 using periodic interrupt function
451 section 14 serial communication interface (sci) 14.1 overview this lsi has an on-chip serial communication interface (sci) that supports both asynchronous and clock synchronous serial communication. it also has a multiprocessor communication function for serial communication among two or more processors. the sci supports a smart card interface, which is a serial communications feature for ic card interfaces that conforms to the iso/iec standard 7816-3 for identification card data transmission protocol type t = 0. see section 15, smart card interface, for more information. 14.1.1 features select asynchronous or clock synchronous as the serial communications mode. ? asynchronous mode: ? serial data communications are synched by start-stop in character units. the sci can communicate with a universal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other communications chip that employs a standard asynchronous serial system. it can also communicate with two or more other processors using the multiprocessor communication function. there are 12 selectable serial data communication formats. ? data length: seven or eight bits ? stop bit length: one or two bits ? parity: even, odd, or none ? multiprocessor bit: 1 or 0 ? receive error detection: parity, overrun, and framing errors ? break detection: by reading the rxd level directly from the port sc data register (scsptr) when a framing error occurs ? clock synchronous mode: ? serial data communication is synchronized with a clock signal. the sci can communicate with other chips having a clock synchronous communication function. there is one serial data communication format. ? data length: eight bits ? receive error detection: overrun errors ? full duplex communication: the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. both sections use double buffering, so continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates
452 ? internal or external transmit/receive clock source: from either baud rate generator (internal) or sck pin (external) ? four types of interrupts: transmit-data-empty, transmit-end, receive-data-full, and receive- error interrupts are requested independently. ? when the sci is not in use, it can be stopped by halting the clock supplied to it, saving power. 14.1.2 block diagram figure 14.1 shows a sci block diagram. rxd txd sck sci scbrr scssr scscr sctdr sctsr scrdr scrsr scsmr scpdr scpcr scssr parity generation parity check clock external clock module data bus internal data bus p p /4 p /16 p /64 txi tei rxi eri bus interface baud rate generator transmit/ receive control scrsr: scrdr: sctsr: sctdr: scsmr: receive shift register receive data register transmit shift register transmit data register serial mode register scscr: scssr: scbrr: scpdr: scpcr: serial control register serial status register bit rate register sc port data register sc port control register legend: figure 14.1 sci block diagram
453 figures 14.2, 14.3, and 14.4 show the block diagrams of the sci i/o port. internal data bus output enable clock input enable sci serial clock output serial clock input r scp1md0 pcrw reset c q q d r scp1md1 pcrw reset c qd r scp1dt1 pdrw reset scpt[1]/sck0 c d pdrw: scpdr write pdrr: pcrw: scpdr read scpcr write pdrr * note: * when reading the sck0 pin, clear the c/ a bit in scsmr and the cke1 and cke0 bits in scscr to 0, and set the scp1md1 bit in scpcr to 1 (see section 14.2.8). legend: figure 14.2 scpt[1]/sck0 pin
454 internal data bus output enable sci serial transmission output q r scp0dt1 pdrw reset scpt[0]/txd0 c d pcrw: pdrw: scpcr write scpdr write r scp0md0 pcrw reset c q d r scp0md1 pcrw reset c qd legend: figure 14.3 scpt[0]/txd0 pin
455 sci serial receive data internal data bus pdrr * scpt[0]/rxd0 pdrr: pdr read note: * when reading the rxd0 pin, set the re bit in scscr to 1. legend: figure 14.4 scpt[0]/rxd0 pin 14.1.3 pin configuration the sci has the serial pins summarized in table 14.1. table 14.1 sci pins pin name abbreviation i/o function serial clock pin sck0 i/o clock i/o receive data pin rxd0 input receive data input transmit data pin txd0 output transmit data output note: they are made to function as serial pins by performing sci operation settings with the te, re, ckei, and ckeo bits in scscr and the c/ a bit in scsmr. break state transmission and detection can be performed by means of the scis scsptr register.
456 14.1.4 register configuration table 14.2 summarizes the sci internal registers. these registers select the communication mode (asynchronous or clock synchronous), specify the data format and bit rate, and control the transmitter and receiver sections. table 14.2 registers name abbreviation r/w initial value address access size serial mode register scsmr r/w h'00 h'fffffe80 8 bit rate register scbrr r/w h'ff h'fffffe82 8 serial control register scscr r/w h'00 h'fffffe84 8 transmit data register sctdr r/w h'ff h'fffffe86 8 serial status register scssr r/(w) * 1 h'84 h'fffffe88 8 receive data register scrdr r h'00 h'fffffe8a 8 sc port data register scpdr r/w h'00 h'04000136 (h'a4000136) * 2 8 sc port control register scpcr r/w h'a888 h'04000116 (h'a4000116) * 2 16 notes: the registers that have addresses that start with h'04 are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 the only value that can be written is 0 to clear the flags. * 2 when address translation by the mmu does not apply, the address in parentheses should be used. 14.2 register descriptions 14.2.1 receive shift register (scrsr) the receive shift register (scrsr) receives serial data. data input at the rxd pin is loaded into the scrsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to the scrdr. the cpu cannot read or write the scrsr directly. bit: 7 6 5 4 3 2 1 0 r/w:
457 14.2.2 receive data register (scrdr) the receive data register (scrdr) stores serial receive data. the sci completes the reception of one byte of serial data by moving the received data from the receive shift register (scrsr) into the scrdr for storage. the scrsr is then ready to receive the next data. this double buffering allows the sci to receive data continuously. the cpu can read but not write the scrdr. the scrdr is initialized to h'00 by a reset or in standby or module standby modes. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r 14.2.3 transmit shift register (sctsr) the transmit shift register (sctsr) transmits serial data. the sci loads transmit data from the transmit data register (sctdr) into the sctsr, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one-byte data, the sci automatically loads the next transmit data from the sctdr into the sctsr and starts transmitting again. if the tdre bit of the scssr is 1, however, the sci does not load the sctdr contents into the sctsr. the cpu cannot read or write the sctsr directly. bit: 7 6 5 4 3 2 1 0 r/w: 14.2.4 transmit data register (sctdr) the transmit data register (sctdr) is an eight-bit register that stores data for serial transmission. when the sci detects that the transmit shift register (sctsr) is empty, it moves transmit data written in the sctdr into the sctsr and starts serial transmission. continuous serial transmission is possible by writing the next transmit data in the sctdr during serial transmission from the sctsr. the cpu can always read and write the sctdr. the sctdr is initialized to h'ff by a reset or in standby and module standby modes.
458 bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 14.2.5 serial mode register (scsmr) the serial mode register (scsmr) is an eight-bit register that specifies the sci serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write the scsmr. the scsmr is initialized to h'00 by a reset or in standby and module standby modes. bit: 7 6 5 4 3 2 1 0 c/ a chr pe o/ e stop mp cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7communication mode (c/ a ): selects whether the sci operates in the asynchronous or clock synchronous mode. bit 7: c/ a description 0 asynchronous mode (initial value) 1 clock synchronous mode bit 6character length (chr): selects seven-bit or eight-bit data in the asynchronous mode. in the clock synchronous mode, the data length is always eight bits, regardless of the chr setting. bit 6: chr description 0 eight-bit data (initial value) 1 seven-bit data when seven-bit data is selected, the msb (bit 7) of the transmit data register is not transmitted.
459 bit 5parity enable (pe): selects whether to add a parity bit to transmit data and to check the parity of receive data, in the asynchronous mode. in the clock synchronous mode, a parity bit is neither added nor checked, regardless of the pe setting. bit 5: pe description 0 parity bit not added or checked (initial value) 1 parity bit added and checked when pe is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (o/ e ) setting. receive data parity is checked according to the even/odd (o/ e ) mode setting. bit 4parity mode (o/ e ): selects even or odd parity when parity bits are added and checked. the o/ e setting is used only in asynchronous mode and only when the parity enable bit (pe) is set to 1 to enable parity addition and check. the o/ e setting is ignored in the clock synchronous mode, or in the asynchronous mode when parity addition and check is disabled. bit 4: o/ e description 0 even parity (initial value) if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1 odd parity if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined. bit 3stop bit length (stop): selects one or two bits as the stop bit length in the asynchronous mode. this setting is used only in the asynchronous mode. it is ignored in the clock synchronous mode because no stop bits are added. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. bit 3: stop description 0 one stop bit (initial value) in transmitting, a single bit of 1 is added at the end of each transmitted character. 1 two stop bits in transmitting, two bits of 1 are added at the end of each transmitted character.
460 bit 2multiprocessor mode (mp): selects multiprocessor format. when multiprocessor format is selected, settings of the parity enable (pe) and parity mode (o/ e ) bits are ignored. the mp bit setting is used only in the asynchronous mode; it is ignored in the clock synchronous mode. for the multiprocessor communication function, see section 14.3.3, multiprocessor communication. bit 2: mp description 0 multiprocessor function disabled (initial value) 1 multiprocessor format selected bits 1 and 0clock select 1 and 0 (cks1 and cks0): these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available. p , p /4, p /16 and p /64. for further information on the clock source, bit rate register settings, and baud rate, see section 14.2.9, bit rate register (scbrr). bit 1: cks1 bit 0: cks0 description 00p (initial value) 1p /4 10p /16 1p /64 note: p : peripheral clock 14.2.6 serial control register (scscr) the serial control register (scscr) operates the sci transmitter/receiver, selects the serial clock output in the asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write the scscr. the scscr is initialized to h'00 by a reset or in standby and module standby modes. bit: 7 6 5 4 3 2 1 0 tie rie te re mpie teie cke1 cke0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
461 bit 7transmit interrupt enable (tie): enables or disables the transmit-data-empty interrupt (txi) requested when the transmit data register empty bit (tdre) in the serial status register (scssr) is set to 1 due to transfer of serial transmit data from the sctdr to the sctsr. bit 7: tie description 0 transmit-data-empty interrupt request (txi) is disabled (initial value) the txi interrupt request can be cleared by reading tdre after it has been set to 1, then clearing tdre to 0, or by clearing tie to 0. 1 transmit-data-empty interrupt request (txi) is enabled bit 6receive interrupt enable (rie): enables or disables the receive-data-full interrupt (rxi) requested when the receive data register full bit (rdrf) in the serial status register (scssr) is set to 1 due to transfer of serial receive data from the scrsr to the scrdr. it also enables or disables receive-error interrupt (eri) requests. bit 6: rie description 0 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are disabled (initial value) rxi and eri interrupt requests can be cleared by reading the rdrf flag or error flag (fer, per, or orer) after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. 1 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are enabled bit 5transmit enable (te): enables or disables the sci serial transmitter. bit 5: te description 0 transmitter disabled (initial value). the transmit data register empty bit (tdre) in the serial status register (scssr) is fixed to 1. 1 transmitter enabled serial transmission starts when the transmit data register empty (tdre) bit in the serial status register (scssr) is cleared to 0 after writing of transmit data into the sctdr. select the transmit format in the scsmr before setting te to 1. bit 4receive enable (re): enables or disables the sci serial receiver.
462 bit 4: re description 0 receiver disabled (initial value) clearing re to 0 does not affect the receive flags (rdrf, fer, per, orer). these flags retain their previous values. 1 receiver enabled serial reception starts when a start bit is detected in the asynchronous mode, or synchronous clock input is detected in the clock synchronous mode. select the receive format in the scsmr before setting re to 1. bit 3multiprocessor interrupt enable (mpie): enables or disables multiprocessor interrupts. the mpie setting is used only in the asynchronous mode, and only if the multiprocessor mode bit (mp) in the serial mode register (scsmr) is set to 1 during reception. the mpie setting is ignored in the clock synchronous mode or when the mp bit is cleared to 0. bit 3: mpie description 0 multiprocessor interrupts are disabled (normal receive operation) (initial value) mpe is cleared to 0 when mpie is cleared to 0, or the multiprocessor bit (mpb) is set to 1 in receive data. 1 multiprocessor interrupts are enabled receive-data-full interrupt requests (rxi), receive-error interrupt requests (eri), and setting of the rdrf, fer, and orer status flags in the serial status register (scssr) are disabled until data with a multiprocessor bit of 1 is received. the sci does not transfer receive data from the scrsr to the scrdr, does not detect receive errors, and does not set the rdrf, fer, and orer flags in the serial status register (scssr). when it receives data that includes mpb = 1, the scssrs mpb flag is set to 1, and the sci automatically clears mpie to 0, generates rxi and eri interrupts (if the tie and rie bits in the scscr are set to 1), and allows the fer and orer bits to be set. bit 2transmit-end interrupt enable (teie): enables or disables the transmit-end interrupt (tei) requested if sctdr does not contain new transmit data when the msb is transmitted. bit 2: teie description 0 transmit-end interrupt (tei) requests are disabled * (initial value) 1 transmit-end interrupt (tei) requests are enabled * note: * the tei request can be cleared by reading the tdre bit in the serial status register (scssr) after it has been set to 1, then clearing tdre to 0 and clearing the transmit end (tend) bit to 0, or by clearing the teie bit to 0. bits 1 and 0clock enable 1 and 0 (cke1, cke0): these bits select the sci clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output or serial clock input.
463 the cke0 setting is valid only in the asynchronous mode, and only when the sci is internally clock (cke1 = 0). the cke0 setting is ignored in the clock synchronous mode, or when an external clock source is selected (cke1 = 1). before selecting the sci operating mode in the serial mode register (scsmr), set cke1 and cke0. for further details on selection of the sci clock source, see table 14.10 in section 14.3, operation. bit 1: cke1 bit 0: cke0 description 0 0 asynchronous mode internal clock, sck pin used for input pin (input signal is ignored) (initial value) clock synchronous mode internal clock, sck pin used for synchronous clock output (initial value) 1 asynchronous mode internal clock, sck pin used for clock output * 1 clock synchronous mode internal clock, sck pin used for synchronous clock output 1 0 asynchronous mode external clock, sck pin used for clock input * 2 clock synchronous mode external clock, sck pin used for synchronous clock input 1 asynchronous mode external clock, sck pin used for clock input * 2 clock synchronous mode external clock, sck pin used for synchronous clock input notes: * 1 the output clock frequency is the same as the bit rate. * 2 the input clock frequency is 16 times the bit rate. 14.2.7 serial status register (scssr) the serial status register (scssr) is an 8-bit register containing multiprocessor bit values, and status flags that indicate sci operating state. the cpu can always read and write the scssr, but cannot write 1 in the status flags (tdre, rdrf, orer, per, and fer). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 2 (tend) and 1 (mpb) are read-only bits that cannot be written. the scssr is initialized to h'84 by a reset or in standby and module standby modes. bit: 7 6 5 4 3 2 1 0 tdre rdrf orer fer per tend mpb mpbt initial value: 1 0 0 0 0 1 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r r/w note: * the only value that can be written is a 0 to clear the flag.
464 bit 7transmit data register empty (tdre): indicates that the sci has loaded transmit data from the sctdr into the sctsr and new serial transmit data can be written in the sctdr. bit 7: tdre description 0 sctdr contains valid transmit data tdre is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre or data is written in sctdr. 1 sctdr does not contain valid transmit data (initial value) tdre is set to 1 when the chip is reset or enters standby mode, the te bit in the serial control register (scscr) is cleared to 0, or sctdr contents are loaded into sctsr, so new data can be written in sctdr. bit 6receive data register full (rdrf): indicates that scrdr contains received data. bit 6: rdrf description 0 scrdr does not contain valid received data (initial value) rdrf is cleared to 0 when the chip is reset or enters standby mode, or software reads rdrf after it has been set to 1, then writes 0 in rdrf. 1 scrdr contains valid received data rdrf is set to 1 when serial data is received normally and transferred from scrsr to scrdr. note: the scrdr and rdrf are not affected by detection of receive errors or by clearing of the re bit to 0 in the serial control register. they retain their previous contents. if rdrf is still set to 1 when reception of the next data ends, an overrun error (orer) occurs and the received data is lost. bit 5overrun error (orer): indicates that data reception aborted due to an overrun error. bit 5: orer description 0 receiving is in progress or has ended normally * 1 (initial value) orer is cleared to 0 when the chip is reset or enters standby mode or software reads orer after it has been set to 1, then writes 0 in orer. 1 a receive overrun error occurred * 2 orer is set to 1 if reception of the next serial data ends when rdrf is set to 1. notes: * 1 clearing the re bit to 0 in the serial control register does not affect the orer bit, which retains its previous value. * 2 scrdr continues to hold the data received before the overrun error, so subsequent receive data is lost. serial receiving cannot continue while orer is set to 1. in the clock synchronous mode, serial transmitting is also disabled.
465 bit 4framing error (fer): indicates that data reception aborted due to a framing error in the asynchronous mode. bit 4: fer description 0 receiving is in progress or has ended normally (initial value) clearing the re bit to 0 in the serial control register does not affect the fer bit, which retains its previous value. fer is cleared to 0 when the chip is reset or enters standby mode or software reads fer after it has been set to 1, then writes 0 in fer. 1 a receive framing error occurred when the stop bit length is two bits, only the first bit is checked. the second stop bit is not checked. when a framing error occurs, the sci transfers the receive data into the scrdr but does not set rdrf. serial receiving cannot continue while fer is set to 1. in the clock synchronous mode, serial transmitting is also disabled. fer is set to 1 if the stop bit at the end of receive data is checked and found to be 0. bit 3parity error (per): indicates that data reception (with parity) aborted due to a parity error in the asynchronous mode. bit 3: per description 0 receiving is in progress or has ended normally (initial value) clearing the re bit to 0 in the serial control register does not affect the per bit, which retains its previous value. per is cleared to 0 when the chip is reset or enters standby mode or software reads per after it has been set to 1, then writes 0 in per. 1 a receive parity error occurred when a parity error occurs, the sci transfers the receive data into the scrdr but does not set rdrf. serial receiving cannot continue while per is set to 1. in the clock synchronous mode, serial transmitting is also disabled. per is set to 1 if the number of 1s in receive data, including the parity bit, does not match the even or odd parity setting of the parity mode bit (o/ e ) in the serial mode register (scsmr).
466 bit 2transmit end (tend): indicates that when the last bit of a serial character was transmitted, the sctdr did not contain valid data, so transmission has ended. tend is a read- only bit and cannot be written. bit 2: tenddescription 0 transmission is in progress tend is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre. 1 end of transmission (initial value) tend is set to 1 when the chip is reset or enters standby mode. te is cleared to 0 in the serial control register (scscr), or tdre is 1 when the last bit of a one- byte serial character is transmitted. bit 1multiprocessor bit (mpb): stores the value of the multiprocessor bit in receive data when a multiprocessor format is selected for receiving in the asynchronous mode. the mpb is a read-only bit and cannot be written. bit 1: mpb description 0 multiprocessor bit value in receive data is 0 (initial value) if re is cleared to 0 when a multiprocessor format is selected, the mpb retains its previous value. 1 multiprocessor bit value in receive data is 1 bit 0multiprocessor bit transfer (mpbt): stores the value of the multiprocessor bit added to transmit data when a multiprocessor format is selected for transmitting in the asynchronous mode. the mpbt setting is ignored in the clock synchronous mode, when a multiprocessor format is not selected, or when the sci is not transmitting. bit 0: mpbt description 0 multiprocessor bit value in transmit data is 0 (initial value) 1 multiprocessor bit value in transmit data is 1
467 14.2.8 sc port control register (scpcr)/sc port data register (scpdr) the sc port control register (scpcr) and sc port data register (scpdr) control i/o and data for the port multiplexed with the serial communication interface (sci) pins. scpcr settings are used to perform i/o control, to enable data written in scpdr to be output to the txd pin, and input data to be read from the rxd pin, and to control serial transmission/reception breaks. it is also possible to read data on the sck pin, and write output data. scpcr bit: 1514131211109876543210 scp7 md1 scp7 md0 scp6 md1 scp6 md0 scp5 md1 scp5 md0 scp4 md1 scp4 md0 scp3 md1 scp3 md0 scp2 md1 scp2 md0 scp1 md1 scp1 md0 scp0 md1 scp0 md0 initial value: 1010100010001000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w scpdr bit: 7 6 5 4 3 2 1 0 scp7dt scp6dt scp5dt scp4dt scp3dt scp2dt scp1dt scp0dt initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w sci pin i/o and data control are performed by bits 3C0 of scpcr and bits 1 and 0 of scpdr. scpcr bits 3 and 2serial clock port i/o (scp1md1, scp1md0): these bits specify serial port sck pin i/o. when the sck pin is actually used as a port i/o pin, clear the c/ a bit of scsmr and bits cke1 and cke0 of scscr to 0. bit 3: scp1md1 bit 2: scp1md0 description 0 0 scp1dt bit value is not output to sck pin 0 1 scp1dt bit value is output to sck pin 1 0 sck pin value is read from scp1dt bit 1 1 (initial values: 1 and 0)
468 scpdr bit 1serial clock port data (scp1dt): specifies the serial port sck pin i/o data. input or output is specified by the scp1md0 and scp1md1 bits. in output mode, the value of the scp1dt bit is output to the sck pin. in output mode, the sck pin value is read from the scp1dt bit. bit 1: scp1dt description 0 i/o data is low (initial value) 1 i/o data is high scpdr bits 1 and 0serial port break i/o (scp0md1, scp0md0): these bits specify the serial port txd pin output condition. when the txd pin is actually used as a port output pin and outputs the value set with the scp0dt bit, clear the te bit of scscr to 0. bit 1: scp0md1 bit 0: scp0md0 description 0 0 scp0dt bit value is not output to txd pin (initial value) 0 1 scp0dt bit value is output to txd pin scpcr bit 0serial port break data (scp0dt): specifies the serial port rxd pin input data and txd pin output data. the txd pin output condition is specified by the scp0md0 and scp0md1 bits. when the txd pin is set to output mode, the value of the scp0dt bit is output to the txd pin. the rxd pin value is read from the scp0dt bit regardless of the values of the scp0md0 and scp0md1 bits, if re in the scscr is set to 1. the initial value of this bit after a power-on reset is undefined. bit 0: scp0dt description 0 i/o data is low (initial value) 1 i/o data is high block diagrams of the sci i/o ports are shown in figures 14.2, 14.3, and 14.4.
469 14.2.9 bit rate register (scbrr) the bit rate register (scbrr) is an eight-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the serial mode register (scsmr), determines the serial transmit/receive bit rate. the cpu can always read and write the scbrr. the scbrr is initialized to h'ff by a reset or in module standby or standby mode. each channel has independent baud rate generator control, so different values can be set in two channels. bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the scbrr setting is calculated as follows: asynchronous mode: n = [p /(64 2 2n C 1 b)] 10 6 C 1 clock synchronous mode: n = [p /(8 2 2n C 1 b)] 10 6 C 1 b: bit rate (bit/s) n: scbrr setting for baud rate generator (0 n 255) p : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 14.3.) table 14.3 scsmr settings scsmr settings n clock source cks1 cks0 0p 00 1p /4 0 1 2p /16 1 0 3p /64 1 1 note: find the bit rate error for the asynchronous mode by the following formula: error ( % ) = {p( 10 6 )/[(n + 1) b 64 2 2n C 1 ]} 100 table 14.4 lists examples of scbrr settings in the asynchronous mode; table 14.5 lists examples of scbrr settings in the clock synchronous mode.
470 table 14.4 bit rates and scbrr settings in asynchronous mode p (mhz) 2 2.097152 2.4576 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 1 141 0.03 1 148 C0.04 1 174 C0.26 150 1 103 0.16 1 108 0.21 1 127 0.00 300 0 207 0.16 0 217 0.21 0 255 0.00 600 0 103 0.16 0 108 0.21 0 127 0.00 1200 0 51 0.16 0 54 C0.70 0 63 0.00 2400 0 25 0.16 0 26 1.14 0 31 0.00 4800 0 12 0.16 0 13 C2.48 0 15 0.00 9600 0 6 C6.99 0 6 C2.48 0 7 0.00 19200 0 2 8.51 0 2 13.78 0 3 0.00 31250 0 1 0.00 0 1 4.86 0 1 22.88 38400 0 1 C18.62 0 1 C14.67 0 1 0.00 p (mhz) 3 3.6864 4 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 1 212 0.03 2 64 0.70 2 70 0.03 150 1 155 0.16 1 191 0.00 1 207 0.16 300 1 77 0.16 1 95 0.00 1 103 0.16 600 0 155 0.16 0 191 0.00 0 207 0.16 1200 0 77 0.16 0 95 0.00 0 103 0.16 2400 0 38 0.16 0 47 0.00 0 51 0.16 4800 0 19 C2.34 0 23 0.00 0 25 0.16 9600 0 9 C2.34 0 11 0.00 0 12 0.16 19200 0 4 C2.34 0 5 0.00 0 6 C6.99 31250 0 2 0.00 0 3 0.00 38400 0 2 0.00 0 2 8.51
471 table 14.4 bit rates and scbrr settings in asynchronous mode (cont) p (mhz) 4.9152 5 6 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 86 0.31 2 88 C0.25 2 106 C0.44 150 1 255 0.00 2 64 0.16 2 77 0.16 300 1 127 0.00 1 129 0.16 1 155 0.16 600 0 255 0.00 1 64 0.16 1 77 0.16 1200 0 127 0.00 0 129 0.16 0 155 0.16 2400 0 63 0.00 0 64 0.16 0 77 0.16 4800 0 31 0.00 0 32 C1.36 0 38 0.16 9600 0 15 0.00 0 15 1.73 0 19 C2.34 19200 0 7 0.00 0 7 1.73 0 9 C2.34 31250 0 4 C1.70 0 4 0.00 0 5 0.00 38400 0 3 0.00 0 3 1.73 0 4 C2.34 p (mhz) 6.144 7.3728 8 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 108 0.08 2 130 C0.07 2 141 0.03 150 2 79 0.00 2 95 0.00 2 103 0.16 300 1 159 0.00 1 191 0.00 1 207 0.16 600 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 2.40 0 6 5.33 0 7 0.00 38400 0 4 0.00 0 5 0.00 0 6 C6.99
472 table 14.4 bit rates and scbrr settings in asynchronous mode (cont) p (mhz) 9.8304 10 12 12.288 bit rate (bits/s) n n error ( % )n n error ( % )n n error ( % )n n error ( % ) 110 2 174 C0.26 2 177 C0.25 2 212 0.03 2 217 0.08 150 2 127 0.00 2 129 0.16 2 155 0.16 2 159 0.00 300 1 255 0.00 2 64 0.16 2 77 0.16 2 79 0.00 600 1 127 0.00 1 129 0.16 1 155 0.16 1 159 0.00 1200 0 255 0.00 1 64 0.16 1 77 0.16 1 79 0.00 2400 0 127 0.00 0 129 0.16 0 155 0.16 0 159 0.00 4800 0 63 0.00 0 64 0.16 0 77 0.16 0 79 0.00 9600 0 31 0.00 0 32 C1.36 0 38 0.16 0 39 0.00 19200 0 15 0.00 0 15 1.73 0 19 0.16 0 19 0.00 31250 0 9 C1.70 0 9 0.00 0 11 0.00 0 11 2.40 38400 0 7 0.00 0 7 1.73 0 9 C2.34 0 9 0.00 p (mhz) 14.7456 16 19.6608 20 bit rate (bits/s) n n error ( % )n n error ( % )n n error ( % )n n error ( % ) 110 3 64 0.70 3 70 0.03 3 86 0.31 3 88 C0.25 150 2 191 0.00 2 207 0.16 2 255 0.00 3 64 0.16 300 2 95 0.00 2 103 0.16 2 127 0.00 2 129 0.16 600 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 1200 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 2400 0 191 0.00 0 207 0.16 0 255 0.00 1 64 0.16 4800 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 9600 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 19200 0 23 0.00 0 25 0.16 0 31 0.00 0 32 C1.36 31250 0 14 C1.70 0 15 0.00 0 19 C1.70 0 19 0.00 38400 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73
473 table 14.4 bit rates and scbrr settings in asynchronous mode (cont) p (mhz) 24 24.576 28.7 30 bit rate (bits/s) n n error ( % )n n error ( % )n n error ( % )n n error ( % ) 110 3 106 C0.44 3 108 0.08 3 126 0.31 3 132 0.13 150 3 77 0.16 3 79 0.00 3 92 0.46 3 97 C0.35 300 2 155 0.16 2 159 0.00 2 186 C0.08 2 194 0.16 600 2 77 0.16 2 79 0.00 2 92 0.46 2 97 C0.35 1200 1 155 0.16 1 159 0.00 1 186 C0.08 1 194 0.16 2400 1 77 0.16 1 79 0.00 1 92 0.46 1 97 C0.35 4800 0 155 0.16 0 159 0.00 0 186 C0.08 0 194 C1.36 9600 0 77 0.16 0 79 0.00 0 92 0.46 0 97 C0.35 19200 0 38 0.16 0 39 0.00 0 46 C0.61 0 48 C0.35 31250 0 23 0.00 0 24 C1.70 0 28 C1.03 0 29 0.00 38400 0 19 C2.34 0 19 0.00 0 22 1.55 0 23 1.73
474 table 14.5 bit rates and scbrr settings in clock synchronous mode p (mhz) bit rate 4 8 16 28.7 30 (bits/s) n n n n n n n n n n 110 250 2 249 3 124 3 249 500 2 124 2 249 3 124 3 223 3 233 1k 1 249 2 124 2 249 3 111 3 116 2.5k 1 99 1 199 2 99 2 178 2 187 5k 0 199 1 99 1 199 2 89 2 93 10k 0 99 0 199 1 99 1 178 1 187 25k 0 39 0 79 0 159 1 71 1 74 50k 0 19 0 39 0 79 0 143 0 149 100k 09019039071074 250k 0307015029 500k 010307014 1m 0 0 * 0 1 0 3 2m 0 0 * 0 1 note: settings with an error of 1 % or less are recommended. blank: no setting possible : setting possible, but error occurs * : continuous transmit/receive not possible
475 table 14.6 indicates the maximum bit rates in the asynchronous mode when the baud rate generator is being used. tables 14.7 and 14.8 list the maximum rates for external clock input. table 14.6 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p (mhz) maximum bit rate (bits/s) n n 2 62500 0 0 2.097152 65536 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 8 250000 0 0 9.8304 307200 0 0 12 375000 0 0 14.7456 460800 0 0 16 500000 0 0 19.6608 614400 0 0 20 625000 0 0 24 750000 0 0 24.576 768000 0 0 28.7 896875 0 0 30 937500 0 0
476 table 14.7 maximum bit rates during external clock input (asynchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 2 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 8 2.0000 125000 9.8304 2.4576 153600 12 3.0000 187500 14.7456 3.6864 230400 16 4.0000 250000 19.6608 4.9152 307200 20 5.0000 312500 24 6.0000 375000 24.576 6.1440 384000 28.7 7.1750 448436 30 7.5000 468750 table 14.8 maximum bit rates during external clock input (clock synchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 8 1.3333 1333333.3 16 2.6667 2666666.7 24 4.0000 4000000.0 28.7 4.7833 4783333.3 30 5.0000 5000000.0
477 14.3 operation 14.3.1 overview for serial communication, the sci has an asynchronous mode in which characters are synchronized individually, and a clock synchronous mode in which communication is synchronized with clock pulses. asynchronous/clock synchronous mode and the transmission format are selected in the serial mode register (scsmr), as listed in table 14.9. the sci clock source is selected by the combination of the c/ a bit in the serial mode register (scsmr) and the cke1 and cke0 bits in the serial control register (scscr), as listed in table 14.10. asynchronous mode: ? data length is selectable: seven or eight bits. ? parity and multiprocessor bits are selectable. so is the stop bit length (one or two bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing errors (fer), parity errors (per), overrun errors (orer) and breaks. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and can output a serial clock signal with a frequency matching the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) clock synchronous mode: ? the transmission/reception format has a fixed eight-bit data length. ? in receiving, it is possible to detect overrun errors (orer). ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and outputs a synchronous clock signal to external devices. ? when an external clock is selected, the sci operates on the input synchronous clock. the on-chip baud rate generator is not used.
478 table 14.9 serial mode register settings and sci communication formats scsmr settings sci communication format mode bit 7 c/ a bit 6 chr bit 5 pe bit 2 mp bit 3 stop data length parity bit multipro- cessor bit stop bit length asynchronous 0 0000 8-bit not set not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits 1 0 0 7-bit not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits asynchronous 0 * 1 0 8-bit not set set 1 bit (multiprocessor * 1 2 bits format) 1 * 0 7-bit 1 bit * 1 2 bits clock synchronous 1 **** 8-bit not set none note: asterisks ( * ) indicate dont-care bits. table 14.10 scsmr and scscr settings and sci clock source selection scsmr scscr settings sci transmit/receive clock mode bit 7 c/ a bit 1 cke1 bit 0 cke0 clock source sck pin function asynchronous 0 0 0 internal sci does not use the sck pin mode 1 outputs a clock with frequency matching the bit rate 1 0 external inputs a clock with frequency 16 1 times the bit rate clock synch- 1 0 0 internal outputs the synchronous clock ronous mode 1 1 0 external inputs the synchronous clock 1
479 14.3.2 operation in asynchronous mode in the asynchronous mode, each transmitted or received character begins with a start bit and ends with a stop bit. serial communication is synchronized one character at a time. the transmitting and receiving sections of the sci are independent, so full duplex communication is possible. the transmitter and receiver are both double buffered, so data can be written and read while transmitting and receiving are in progress, enabling continuous transmitting and receiving. figure 14.5 shows the general format of asynchronous serial communication. in asynchronous serial communication, the communication line is normally held in the mark (high) state. the sci monitors the line and starts serial communication when the line goes to the space (low) state, indicating a start bit. one serial character consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in the asynchronous mode, the sci synchronizes on the falling edge of the start bit. the sci samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. 0d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 1 1 0/1 1 1 (lsb) (msb) serial data start bit 1 bit transmit/receive data 7 or 8 bits one unit of communication data (character or frame) example: 8-bit data with parity and two stop bits idling (marking) parity bit stop bit 1 or no bit 1 or 2 bits figure 14.5 data format in asynchronous communication
480 transmit/receive formats: table 14.11 lists the 12 communication formats that can be selected in the asynchronous mode. the format is selected by settings in the serial mode register (scsmr). table 14.11 serial communication formats (asynchronous mode) scsmr bits serial transmit/receive format and frame length chr pe mp stop 1 23456789 10 11 12 0 0 0 0 start 8-bit data stop 0 0 0 1 start 8-bit data stop stop 0 1 0 0 start 8-bit data p stop 0 1 0 1 start 8-bit data p stop stop 1 0 0 0 start 7-bit data stop 1 0 0 1 start 7-bit data stop stop 1 1 0 0 start 7-bit data p stop 1 1 0 1 start 7-bit data p stop stop 0 1 0 start 8-bit data mpb stop 0 1 1 start 8-bit data mpb stop stop 1 1 0 start 7-bit data mpb stop 1 1 1 start 7-bit data mpb stop stop : dont care bits start: start bit stop: stop bit p: parity bit mpb: multiprocessor bit clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (scsmr) and bits cke1 and cke0 in the serial control register (scscr) (table 14.10). when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate.
481 when the sci operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to the bit rate. the phase is aligned as in figure 14.6 so that the rising edge of the clock occurs at the center of each transmit data bit. 0 d0d1d2d3d4d5d6d70/1 1 1 1 frame figure 14.6 output clock and serial data timing (asynchronous mode) transmitting and receiving data (sci initialization (asynchronous mode)): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci as follows. when changing the operation mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (sctsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags or receive data register (scrdr), which retain their previous contents. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. sci operation becomes unreliable if the clock is stopped. figure 14.7 is a sample flowchart for initializing the sci. the procedure for initializing the sci is: 1. select the clock source in the serial control register (scscr). leave rie, tie, teie, mpie, te, and re cleared to 0. if clock output is selected in asynchronous mode, clock output starts immediately after the setting is made to scscr. 2. select the communication format in the serial mode register (scsmr). 3. write the value corresponding to the bit rate in the bit rate register (scbrr) unless an external clock is used. 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scscr) to 1. also set rie, tie, teie, and mpie as necessary. setting te or re enables the sci to use the txd or rxd pin. the initial states are the mark transmit state, and the idle receive state (waiting for a start bit).
482 initialize clear te and re bits in scscr to 0 select transmit/receive format in scsmr set value to scbrr set cke1 and cke0 bits in scscr (te and re bits are 0) wait set te and re bits in scscr to 1 and set rie, teie, and mpie bits has a 1-bit interval elapsed? end (2) (3) (1) (4) no yes note: numbers refer to the preceding procedure. figure 14.7 sample flowchart for sci initialization transmitting serial data (asynchronous mode): figure 14.8 shows a sample flowchart for transmitting serial data. the procedure for transmitting serial data is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to 0. 2. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. 3. to output a break at the end of serial transmission: set the port sc data register (scpdr) and port sc control register (scpcr), then clear the te bit to 0 in the serial control register (scscr). for scpcr and scpdr settings, see section 14.2.8.
483 tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 all data transmitted? yes tend = 1? read tend bit in scssr break output? yes clear te bit scscr to 0 end transmission yes read tdre bit in scssr no no yes no no (1) (2) (3) start transmission note: numbers refer to the preceding procedure. set scpdr and scpcr figure 14.8 sample flowchart for transmitting serial data
484 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in the scssr. when tdre is cleared to 0, the sci recognizes that the transmit data register (sctdr) contains new data, and loads this data from the sctdr into the transmit shift register (sctsr). 2. after loading the data from the sctdr into the sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) is set to 1 in the scscr, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits of data are output, lsb first. c. parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit is output. formats in which neither a parity bit nor a multiprocessor bit is output can also be selected. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads new data from the sctdr into the sctsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit to 1 in the scssr, outputs the stop bit, then continues output of 1 bits (marking). if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested.
485 figure 14.9 shows an example of sci transmit operation in the asynchronous mode. 01 1 1 0/1 0 1 tdre tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idle (marking) txi interrupt request generated example: 8-bit data with parity and one stop bit tei interrupt request generated writes data to sctdr with the txi interrupt processing routine and clear tdre bit to 0 1 frame d 0 d 1 d 7 d 0 d 1 d 7 0/1 txi interrupt request generated figure 14.9 sci transmit operation in asynchronous mode receiving serial data (asynchronous mode): figure 14.10 shows a sample flowchart for receiving serial data. the procedure for receiving serial data after enabling the sci for reception is: 1. receive error processing and break detection: if a receive error occurs, read the orer, per and fer bits of the scssr to identify the error. after executing the necessary error processing, clear orer, per and fer all to 0. receiving cannot resume if orer, per or fer remain set to 1. when a framing error occurs, the rxd pin can be read to detect the break state. 2. sci status check and receive-data read: read the serial status register (scssr), check that rdrf is set to 1, then read receive data from the receive data register (scrdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 3. to continue receiving serial data: read the rdrf and scrdr bits and clear rdrf to 0 before the stop bit of the current frame is received.
486 start reception read orer, per, and fer bits in scssr all data received? end reception (1) no yes per = 1 or fer = 1 or orer = 1? rdrf = 1? yes yes clear the re bit in scscr to 0 no no read the rdrf bit in scssr error processing (3) (2) read reception data of scrdr and clear rdrf bit in scssr to 0 note: numbers refer to the preceding procedure. figure 14.10 sample flowchart for receiving serial data
487 error processing orer = 1? overrun error processing fer = 1? yes break? no framing error processing per = 1? yes parity error processing clear orer, per, and fer bits in scssr to 0 end no no no yes yes clear re bit in scscr to 0 figure 14.10 sample flowchart for receiving serial data (cont)
488 in receiving, the sci operates as follows: 1. the sci monitors the communication line. when it detects a start bit (0), the sci synchronizes internally and starts receiving. 2. receive data is shifted into the scrsr in order from the lsb to the msb. 3. the parity bit and stop bit are received. after receiving these bits, the sci makes the following checks: a. parity check: the number of 1s in the receive data must match the even or odd parity setting of the o/ e bit in the scsmr. b. stop bit check: the stop bit value must be 1. if there are two stop bits, only the first stop bit is checked. c. status check: rdrf must be 0 so that receive data can be loaded from the scrsr into the scrdr. if these checks all pass, the sci sets rdrf to 1 and stores the received data in the scrdr. if one of the checks fails (receive error), the sci operates as indicated in table 14.12. note: when a receive error flag is set, further receiving is disabled. the rdrf bit is not set to 1. be sure to clear the error flags. 4. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in the scscr, the sci requests a receive-data-full interrupt (rxi). if one of the error flags (orer, per, or fer) is set to 1 and the receive-data-full interrupt enable bit (rie) in the scscr is also set to 1, the sci requests a receive-error interrupt (eri). table 14.12 receive error conditions and sci operation receive error abbreviation condition data transfer overrun error orer receiving of next data ends while rdrf is still set to 1 in scssr receive data not loaded from scrsr into scrdr framing error fer stop bit is 0 receive data loaded from scrsr into scrdr parity error per parity of receive data differs from even/odd parity setting in scsmr receive data loaded from scrsr into scrdr
489 figure 14.11 shows an example of sci receive operation in the asynchronous mode. rdrf fer eri interrupt request generated by framing error 1 frame example: 8-bit data with parity and one stop bit reads data with the rxi interrupt processing routine and clears rdrf bit to 0 rxi interrupt request generated 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0/1 figure 14.11 sci receive operation 14.3.3 multiprocessor communication the multiprocessor communication function enables several processors to share a single serial communication line. the processors communicate in the asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format). in multiprocessor communication, each receiving processor is addressed by a unique id. a serial communication cycle consists of an id-sending cycle that identifies the receiving processor, and a data-sending cycle. the multiprocessor bit distinguishes id-sending cycles from data-sending cycles. the transmitting processor starts by sending the id of the receiving processor with which it wants to communicate as data with the multiprocessor bit set to 1. next the transmitting processor sends transmit data with the multiprocessor bit cleared to 0. receiving processors skip incoming data until they receive data with the multiprocessor bit set to 1. when they receive data with the multiprocessor bit set to 1, receiving processors compare the data with their ids. the receiving processor with a matching id continues to receive further incoming data. processors with ids not matching the received data skip further incoming data until they again receive data with the multiprocessor bit set to 1. multiple processors can send and receive data in this way.
490 figure 14.12 shows an example of communication among processors using the multiprocessor format. receiving station a (id = 01) (id = 02) (id = 03) (id = 04) receiving station b receiving station c serial communications circuit h'01 h'aa (mpb = 0) (mpb = 1) id transmit cycle = specifies receiving station serial data transmitting station receiving station d data transmit cycle = data transmission to receiving station specified by id mpb: multiprocessor bit example: sending data h'aa to receiving processor a figure 14.12 communication among processors using multiprocessor format communication formats: four formats are available. parity-bit settings are ignored when the multiprocessor format is selected. for details see table 14.11. clock: see the description in the asynchronous mode section. transmitting multiprocessor serial data: figure 14.13 shows a sample flowchart for transmitting multiprocessor serial data. the procedure for transmitting multiprocessor serial data is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr). also set mpbt (multiprocessor bit transfer) to 0 or 1 in scssr. finally, clear tdre to 0. 2. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. 3. to output a break at the end of serial transmission: set the port sc data register (scpdr) and port sc control register (scpcr), then clear the te bit to 0 in the serial control register (scscr). for scpcr and scpdr settings, see section 14.2.8.
491 tdre = 1? write transmission data to sctdr and set mpbt bit in scssr transmission ended? yes tend = 1? read tend bit in scssr break output? yes set scpdr and scpcr end transmission yes read tdre bit in scssr clear tdre bit to 0 no no yes no no (1) (2) (3) start transmission note: numbers refer to the preceding procedure. clear te bit scscr to 0 figure 14.13 sample flowchart for transmitting multiprocessor serial data
492 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in the scssr. when tdre is cleared to 0 the sci recognizes that the transmit data register (sctdr) contains new data, and loads this data from the sctdr into the transmit shift register (sctsr). 2. after loading the data from the sctdr into the sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in the scscr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits are output, lsb first. c. multiprocessor bit: one multiprocessor bit (mpbt value) is output. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads data from the sctdr into the sctsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in the scssr to 1, outputs the stop bit, then continues output of 1 bits in the marking state. if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested at this time.
493 figure 14.14 shows sci transmission in the multiprocessor format. tdre tend txi interrupt request generated txi interrupt request generated tei interrupt request generated writes data to tdr with the txi interrupt pro- cessing routine and clears tdre bit to 0 example: 8-bit data with multiprocessor bit and one stop bit 1 frame 01 1 1 0/1 0 1 multi- processor bit serial data start bit data stop bit start bit data stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0/1 multi- processor bit figure 14.14 sci multiprocessor transmit operation receiving multiprocessor serial data: figure 14.15 shows a sample flowchart for receiving multiprocessor serial data. the procedure for receiving multiprocessor serial data is: 1. id receive cycle: set the mpie bit in the serial control register (scscr) to 1. 2. sci status check and compare to id reception: read the serial status register (scssr), check that rdrf is set to 1, then read data from the receive data register (scrdr) and compare with the processors own id. if the id does not match the receive data, set mpie to 1 again and clear rdrf to 0. if the id matches the receive data, clear rdrf to 0. 3. sci status check and data receiving: read scssr, check that rdrf is set to 1, then read data from the receive data register (scrdr). 4. receive error processing and break detection: if a receive error occurs, read the orer and fer bits in scssr to identify the error. after executing the necessary error processing, clear both orer and fer to 0. receiving cannot resume if orer or fer remain set to 1. when a framing error occurs, the rxd pin can be read to detect the break state.
494 rdrf = 1? fer = 1 or orer = 1? rdrf = 1? all data received? no end reception yes set mpie bit in scscr to 1 read rdrf bit in scssr clear re bit in scscr to 0 no no (1) (2) read orer and fer bits in scssr fer = 1 or orer = 1? read rdrf bit in scssr read receive data in scrdr is id the stations id? yes read orer and fer bits in sscsr (3) no error processing yes yes (4) yes no start reception no yes read receive data in scrdr note: numbers refer to the preceding procedure. figure 14.15 sample flowchart for receiving multiprocessor serial data
495 orer = 1? break? yes framing error processing yes error processing overrun error processing yes fer = 1? clear orer and fer bits in scssr to 0 end no no no clear re bit in scscr to 0 figure 14.15 sample flowchart for receiving multiprocessor serial data (cont)
496 figure 14.16 shows an example of sci receive operation using a multiprocessor format. rdrf mpie rdr value id1 rxi interrupt request (multiprocessor interrupt) generated, mpie = 0 example: format: own id does not match data 8-bit data with multi p rocessor bit and one sto p bit reads rdr data with the rxi interrupt processing routine and clears rdrf bit to 0 id is not stations id, so mpie bit is set to 1 again no rxi interrupt, generated rdr state is maintained 01 1 1 10 1 stop bit mpb serial data start bit data (id1) data (data 1) start bit mpb stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0 figure 14.16 example of sci receive operation
497 rdrf mpie rdr value example: format: own id matches data 8-bit data with multiprocessor bit and one stop bit id1 id2 data2 01 1 1 10 1 mpb mpb serial data start bit data (id2) data (data 2) stop bit start bit stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0 rxi interrupt request (multiprocessor interrupt) generated, mpie = 0 reads rdr data with the rxi interrupt processing routine and clears rdrf bit to 0 id is that of station, so reception continues unchanged and data is received by the rxi interrupt processing routine mpie bit set to 1 again figure 14.16 example of sci receive operation (cont)
498 14.3.4 clock synchronous operation in the clock synchronous mode, the sci transmits and receives data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. the sci transmitter and receiver are independent, so full-duplex communication is possible while sharing the same clock. the transmitter and receiver are also double buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress. figure 14.17 shows the general format in clock synchronous serial communication. bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb synchroni- zation clock serial data ** one unit of communication data (character or frame) note: * high except in continuous transmitting or receiving figure 14.17 data format in clock synchronous communication in clock synchronous serial communication, each data bit is output on the communication line from one falling edge of the serial clock to the next. data are guaranteed valid at the rising edge of the serial clock. in each character, the serial data bits are transmitted in order from the lsb (first) to the msb (last). after output of the msb, the communication line remains in the state of the msb. in the clock synchronous mode, the sci transmits or receives data by synchronizing with the rising edge of the serial clock. communication format: the data length is fixed at eight bits. no parity bit or multiprocessor bit can be added.
499 clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (scsmr) and bits cke1 and cke0 in the serial control register (scscr). see table 14.10. when the sci operates on an internal clock, it outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received character. when the sci is not transmitting or receiving, the clock signal remains in the high state. when only receiving, the sci receives in 2- character units, so a 16 pulse synchronization clock is output. to receive in 1-character units, select an external clock source. transmitting and receiving data: sci initialization (clock synchronous mode). before transmitting, receiving, or changing the mode or communication format, the software must clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (sctsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and receive data register (scrdr), which retain their previous contents. figure 14.18 is a sample flowchart for initializing the sci. the procedure for initializing the sci is: 1. select the clock source in the serial control register (scscr). leave rie, tie, teie, mpie, te and re cleared to 0. 2. select the communication format in the serial mode register (scsmr). 3. write the value corresponding to the bit rate in the bit rate register (scbrr) unless an external clock is used. 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scscr) to 1. also set rie, tie, teie and mpie. setting te and re allows use of the txd and rxd pins.
500 initialize clear te and re bits in scscr to 0 (1) has a 1-bit period elapsed? set te and re bits in scscr to 1 and set rie, tie, teie, and mpie bits set transmit/receive format in scsmr yes no set value in scbrr set rie, tie, teie, mpie, cke1, and cke0 bits in scscr (te and re are 0) end wait (2) (3) (4) note: numbers refer to the preceding procedure. figure 14.18 sample flowchart for sci initialization transmitting serial data (clock synchronous mode): figure 14.19 shows a sample flowchart for transmitting serial data. the procedure for transmitting serial data is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to 0. 2. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0.
501 start transmission read tdre bit in scssr all data transmitted? yes no end transmission (1) (2) tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 yes no read tend bit in scssr tend = 1? yes no clear te bit in scscr to 0 note: numbers refer to the preceding procedure. figure 14.19 sample flowchart for serial transmitting
502 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in the scssr. when tdre is cleared to 0 the sci recognizes that the transmit data register (sctdr) contains new data and loads this data from the sctdr into the transmit shift register (sctsr). 2. after loading the data from the sctdr into the sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in the scscr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. if clock output mode is selected, the sci outputs eight synchronous clock pulses. if an external clock source is selected, the sci outputs data in synchronization with the input clock. data are output from the txd pin in order from the lsb (bit 0) to the msb (bit 7). 3. the sci checks the tdre bit when it outputs the msb (bit 7). if tdre is 0, the sci loads data from the sctdr into the sctsr, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in the scssr to 1, transmits the msb, then holds the transmit data pin (txd) in the msb state. if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested at this time. 4. after the end of serial transmission, the sck pin is held in the high state. figure 14.20 shows an example of sci transmit operation. bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 synchronization clock serial data transfer direction bit 7 writes data to tdr with the txi interrupt processing routine and clears tdre bit to 0 1 frame tdre tend lsb msb txi interrupt request generated txi interrupt request generated tei interrupt request generated figure 14.20 example of sci transmit operation
503 receiving serial data (clock synchronous mode): figure 14.21 shows a sample flowchart for receiving serial data. when switching from the asynchronous mode to the clock synchronous mode, make sure that orer, per, and fer are cleared to 0. if per or fer is set to 1, the rdrf bit will not be set and both transmitting and receiving will be disabled. the procedure for receiving serial data is: 1. receive error processing: if a receive error occurs, read the orer bit in scssr to identify the error. after executing the necessary error processing, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 2. sci status check and receive data read: read the serial status register (scssr), check that rdrf is set to 1, then read receive data from the receive data register (scrdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 3. to continue receiving serial data: read scrdr, and clear rdrf to 0 before the frame msb (bit 7) of the current frame is received.
504 read orer bit in scssr all data received? end reception no yes orer = 1? rdrf = 1? yes clear re bit in scscr to 0 no no read rdrf bit in scssr (3) (2) yes error processing (1) read receive data in scrdr and clear rdrf bit in scssr to 0 start reception note: numbers refer to the preceding procedure. figure 14.21 sample flowchart for serial data receiving
505 error processing end orer = 1? no clear orer bit in scssr to 0 yes overrun error processing figure 14.21 sample flowchart for serial data receiving (cont) in receiving, the sci operates as follows: 1. the sci synchronizes with serial clock input or output and initializes internally. 2. receive data is shifted into the scrsr in order from the lsb to the msb. after receiving the data, the sci checks that rdrf is 0 so that receive data can be loaded from the scrsr into the scrdr. if this check is passed, the sci sets rdrf to 1 and stores the received data in the scrdr. if the check is not passed (receive error), the sci operates as indicated in table 14.12. this state prevents further transmission or reception. while receiving, the rdrf bit is not set to 1. be sure to clear the error flag. 3. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in the scscr, the sci requests a receive-data-full interrupt (rxi). if the orer bit is set to 1 and the receive-data-full interrupt enable bit (rie) in the scscr is also set to 1, the sci requests a receive-error interrupt (eri). figure 14.22 shows an example of the sci receive operation.
506 bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 synchronization clock serial data transfer direction bit 7 reads data with the rxi interrupt processing routine and clears rdrf bit to 0 1 frame rxi interrupt request generated rxi interrupt request generated eri interrupt request generated by overrun error rdrf orer figure 14.22 example of sci receive operation transmitting and receiving serial data simultaneously (clock synchronous mode): figure 14.23 shows a sample flowchart for transmitting and receiving serial data simultaneously. the procedure for setting the sci to transmit and receive serial data simultaneously is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to 0. the txi interrupt can also be used to determine if the tdre bit has changed from 0 to 1. 2. receive error processing: if a receive error occurs, read the orer bit in scssr to identify the error. after executing the necessary error processing, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 3. sci status check and receive data read: read the serial status register (scssr), check that rdrf is set to 1, then read receive data from the receive data register (scrdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 4. to continue transmitting and receiving serial data: read the rdrf bit and scrdr, and clear rdrf to 0 before the frame msb (bit 7) of the current frame is received. also read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0 before the msb (bit 7) of the current frame is transmitted.
507 start transmission/reception read tdre bit in scssr all data transmitted/received? end transmission/reception (1) no yes tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 rdrf = 1? no yes yes no read orer bit in scssr error processing (2) orer = 1? no read rdrf bit in scssr (4) yes (3) read receive data of scrdr and clear rdrf bit in scssr to 0 clear te and re bits in scscr to 0 notes: 1. 2. numbers refer to the preceding procedure. in switching from transmitting or receiving to simultaneous transmitting and receiving, clear both te and re to 0, then set both te and re to 1. figure 14.23 sample flowchart for serial data transmitting/receiving
508 14.4 sci interrupt sources the sci has four interrupt sources in each channel: transmit-end (tei), receive-error (eri), receive-data-full (rxi), and transmit-data-empty (txi). table 14.13 lists the interrupt sources and indicates their priority. these interrupts can be enabled and disabled by the tie, rie, and teie bits in the serial control register (scscr). each interrupt request is sent separately to the interrupt controller. txi is requested when the tdre bit in the scssr is set to 1. tdre is automatically cleared to 0 when data is written in the transmit data register (sctdr). rxi is requested when the rdrf bit in the scssr is set to 1. rdrf is automatically cleared to 0 when the receive data register (scrdr) is read. eri is requested when the orer, per, or fer bit in the scssr is set to 1. tei is requested when the tend bit in the scssr is set to 1. where the txi interrupt indicates that transmit data writing is enabled, the tei interrupt indicates that the transmit operation is complete. table 14.13 sci interrupt sources interrupt source description priority when reset is cleared eri receive error (orer, per, or fer) high rxi receive data full (rdrf) txi transmit data empty (tdre) tei transmit end (tend) low see section 4, exception processing, for information on the priority order and relationship to non- sci interrupts.
509 14.5 notes on use note the following points when using the sci. sctdr write and tdre flags: the tdre bit in the serial status register (scssr) is a status flag indicating loading of transmit data from the sctdr into the sctsr. the sci sets tdre to 1 when it transfers data from the sctdr to the sctsr. data can be written to the sctdr regardless of the tdre bit state. if new data is written in the sctdr when tdre is 0, however, the old data stored in the sctdr will be lost because the data has not yet been transferred to the sctsr. before writing transmit data to the sctdr, be sure to check that tdre is set to 1. simultaneous multiple receive errors: table 14.14 indicates the state of the scssr status flags when multiple receive errors occur simultaneously. when an overrun error occurs, the scrsr contents cannot be transferred to the scrdr, so receive data is lost. table 14.14 scssr status flags and transfer of receive data scssr status flags receive data transfer receive error status rdrf orer fer per scrsr scrdr overrun error 1 1 0 0 x * 1 framing error 0 0 1 0 o * 2 parity error 0 0 0 1 o overrun error + framing error 1 1 1 0 x overrun error + parity error 1 1 0 1 x framing error + parity error 0 0 1 1 o overrun error + framing error + parity error 1 1 1 1 x notes: * 1 receive data is not transferred from scrsr to scrdr. * 2 receive data is transferred from scrsr to scrdr. break detection and processing: break signals can be detected by reading the rxd pin directly when a framing error (fer) is detected. in the break state, the input from the rxd pin consists of all 0s, so fer is set and the parity error flag (per) may also be set. in the break state, the sci receiver continues to operate, so if the fer bit is cleared to 0, it will be set to 1 again. sending a break signal: the txd pin i/o condition and level can be determined by means of the scp0dt bit of the port sc data register (scpdr) and bits scp0md0 and scp0md1 of the port sc control register (scpcr). these bits can be used to send breaks. to send a break during serial transmission, clear the scp0dt bit to 0 (designating low level), then clear the te bit to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, and 0 is output from the txd pin.
510 tend flag and te bit processing: the tend flag is set to 1 during transmission of the stop bit of the last data. consequently, if the te bit is cleared to 0 immediately after setting of the tend flag has been confirmed, the stop bit will be in the process of transmission and will not be transmitted normally. therefore, the te bit should not be cleared to 0 for at least 0.5 serial clock cycles (or 1.5 cycles if two stop bits are used) after setting of the tend flag setting is confirmed. receive error flags and transmitter operation (clock synchronous mode only): when a receive error flag (orer, per, or fer) is set to 1, the sci will not start transmitting even if tdre is set to 1. be sure to clear the receive error flags to 0 before starting to transmit. note that clearing re to 0 does not clear the receive error flags. receive data sampling timing and receive margin in the asynchronous mode: in the asynchronous mode, the sci operates on a base clock of 16 times the transfer rate frequency. in receiving, the sci synchronizes internally with the falling edge of the start bit, which it samples on the base clock. receive data is latched on the rising edge of the eighth base clock pulse (figure 14.24). 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 basic clock receive data (rxd) synchro- nization sampling timing data sampling timing 8 clocks 16 clocks start bit C7.5 clocks +7.5 clocks d0 d1 figure 14.24 receive data sampling timing in asynchronous mode
511 the receive margin in the asynchronous mode can therefore be expressed as in equation 1. equation 1: m = 0.5 C 1 2n d C 0.5 n C (l C 0.5)f C (1 + f) 100% where: m = receive margin ( % ) n = ratio of clock frequency to bit rate (n = 16) d = clock duty cycle (d = 0C1.0) l = frame length (l = 9C12) f = absolute deviation of clock frequency from equation 1, if f = 0 and d = 0.5, the receive margin is 46.875%, as in equation 2. equation 2: m = (0.5 C 1/(2 16)) 100 % = 46.875 % this is a theoretical value. a reasonable margin to allow in system designs is 20C30%. cautions for clock synchronous external clock mode: ? set te = re = 1 only when the external clock sck is 1. ? do not set te = re = 1 until at least four clocks after the external clock sck has changed from 0 to 1. ? when receiving, rdrf is 1 when re is set to zero 2.5C3.5 clocks after the rising edge of the sck input of the d7 bit in rxd, but it cannot be copied to scrdr. caution for clock synchronous internal clock mode: when receiving, rdrf is 1 when re is set to zero 1.5 clocks after the rising edge of the sck output of the d7 bit in rxd, but it cannot be copied to scrdr.
512
513 section 15 smart card interface 15.1 overview as an added serial communications interface function, the sci supports an ic card (smart card) interface that conforms to the data transfer protocol (asynchronous half-duplex character transmission protocol) of the iso/iec standard 7816-3 for identification of cards. register settings are used to switch between the ordinary serial communication interface and the smart card interface. 15.1.1 features the smart card interface has the following features: ? asynchronous mode ? data length: eight bits ? parity bit generation and check ? receive mode error signal detection (parity error) ? transmit mode error signal detection and automatic re-transmission of data ? supports both direct convention and inverse convention ? bit rate can be selected using on-chip baud rate generator. ? three types of interrupts: transmit-data-empty, receive-data-full, and communication-error interrupts are requested independently.
514 15.1.2 block diagram figure 15.1 shows a block diagram of the smart card interface. rxd txd sck sci scbrr scscr scsmr sctdr sctsr scrdr scrsr scscmr scssr parity generation parity check clock external clock module data bus internal ! "  p /4 p /16 p /64 txi rxi eri bus interface baud rate generator transmit/ receive control scscmr: scrsr: scrdr: sctsr: sctdr: scsmr: scscr: scssr: scbrr: smart card mode register receive shift register receive data register transmit shift register transmit data register serial mode register serial control register serial status register bit rate register legend: figure 15.1 smart card interface block diagram
515 15.1.3 pin configuration table 15.1 summarizes the smart card interface pins. table 15.1 sci pins pin name abbreviation i/o function serial clock pin sck0 output clock output receive data pin rxd0 input receive data input transmit data pin txd0 output transmit data output 15.1.4 register configuration table 15.2 summarizes the registers used by the smart card interface. the scsmr, scbrr, scscr, sctdr, and scrdr registers are the same as in the ordinary sci function. they are described in section 14, serial communication interface. table 15.2 registers name abbreviation r/w initial value * 3 address access size serial mode register scsmr r/w h'00 h'fffffe80 8 bit rate register scbrr r/w h'ff h'fffffe82 8 serial control register scscr r/w h'00 h'fffffe84 8 transmit data register sctdr r/w h'ff h'fffffe86 8 serial status register scssr r/(w) * 1 h'84 h'fffffe88 8 receive data register scrdr r h'00 h'fffffe8a 8 smart card mode register scscmr r/w h'00 * 2 h'fffffe8c 8 notes: * 1 only 0 can be written, to clear the flags. * 2 bits 0, 2, and 3 are cleared. the value of the other bits is undefined. * 3 initialized by a power-on or manual reset.
516 15.2 register descriptions this section describes the registers added for the smart card interface and the bits whose functions are changed. 15.2.1 smart card mode register (scscmr) the smart card mode register (scscmr) is an 8-bit read/write register that selects smart card interface functions. scscmr bits 0, 2, and 3 are initialized to h00 by a reset and in standby mode. bit: 7 6 5 4 3 2 1 0 sdir sinv smif initial value: 0 0 0 r/w: r r r r r/w r/w r r/w bits 7 to 4 and 1reserved: these bits are always read as 0. the write value should always be 0. bit 3smart card data transfer direction (sdir): selects the serial/parallel conversion format. bit 3: sdir description 0 contents of sctdr are transferred as lsb first, receive data is stored in scrdr as lsb first. (initial value) 1 contents of sctdr are transferred as msb first, receive data is stored in scrdr as msb first. bit 2smart card data inversion (sinv): specifies whether to invert the logic level of the data. this function is used in combination with bit 3 for transmitting and receiving with an inverse convention card. sinv does not affect the logic level of the parity bit. see section 15.3.4, register settings, for information on how parity is set. bit 2: sinv description 0 contents of sctdr are transferred unchanged, receive data is stored in scrdr unchanged. (initial value) 1 contents of sctdr are inverted before transfer, receive data is inverted before storage in scrdr.
517 bit 0smart card interface mode select (smif): enables the smart card interface function. bit 0 : smif description 0 smart card interface function disabled (initial value) 1 smart card interface function enabled 15.2.2 serial status register (scssr) in the smart card interface mode, the function of scssr bit 4 is changed. the setting conditions for bit 2, the tend bit, are also changed. bit: 7 6 5 4 3 2 1 0 tdre rdrf orer fer/ers per tend mpb mpbt initial value: 1 0 0 0 0 1 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r r/w note: * only 0 can be written, to clear the flag. bits 7 to 5 these bits have the same function as in the ordinary sci. see section 14, serial communication interface (sci), for more information. bit 4error signal status (ers): in the smart card interface mode, bit 4 indicates the state of the error signal returned from the receiving side during transmission. the smart card interface cannot detect framing errors. bit 4: ers description 0 receiving ended normally with no error signal. (initial value) ers is cleared to 0 when the chip is reset or enters standby mode, or when software reads ers after it has been set to 1, then writes 0 in ers. 1 an error signal indicating a parity error was transmitted from the receiving side. ers is set to 1 if the error signal sampled is low. note: the ers flag maintains its state even when the te bit in scscr is cleared to 0.
518 bits 3 to 0 these bits have the same function as in the ordinary sci. see section 14, serial communication interface (sci), for more information. the setting conditions for bit 2, the transmit end bit (tend), are changed as follows. bit 2: tenddescription 0 transmission is in progress. tend is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre. 1 end of transmission. (initial value) tend is set to 1 when: ? the chip is reset or enters standby mode, ? the te bit in scscr is 0 and the fer/ers bit is also 0, ? the c/ a bit in scsmr is 0, and tdre = 1 and fer/ers = 0 (normal transmission) 2.5 etu after a one-byte serial character is transmitted, or ? the c/ a bit in scsmr is 1, and tdre = 1 and fer/ers = 0 (normal transmission) 1.0 etu after a one-byte serial character is transmitted. note: etu is an abbreviation of elementary time unit, which is the period for the transfer of 1 bit. 15.3 operation 15.3.1 overview the primary functions of the smart card interface are described below. 1. each frame consists of 8-bit data and 1 parity bit. 2. during transmission, the card leaves a guard time of at least 2 etu (elementary time units: the period for 1 bit to transfer) from the end of the parity bit to the start of the next frame. 3. during reception, the card outputs an error signal low level for 1 etu after 10.5 etu has elapsed from the start bit if a parity error was detected. 4. during transmission, it automatically transmits the same data after allowing at least 2 etu from the time the error signal is sampled. 5. only start-stop type asynchronous communication functions are supported; no synchronous communication functions are available.
519 15.3.2 pin connections figure 15.2 shows the pin connection diagram for the smart card interface. during communication with an ic card, transmission and reception are both carried out over the same data transfer line, so connect the txd and rxd pins on the chip. pull up the data transfer line to the power supply v cc side with a resistor. when using the clock generated by the smart card interface on an ic card, input the sck pin output to the ic cards clk pin. this connection is not necessary when the internal clock is used on the ic card. use the chips port output as the reset signal. apart from these pins, the power and ground pin connections are usually also required. note: when the ic card is not connected and both re and te are set to 1, closed communication is possible and auto-diagnosis can be performed. lsi txd io clk rst rxd sck px (port) clock line data line reset line ic card connected device v cc figure 15.2 pin connection diagram for the smart card interface
520 15.3.3 data format figure 15.3 shows the data format for the smart card interface. in this mode, parity is checked every frame while receiving and error signals sent to the transmitting side whenever an error is detected so that data can be re-transmitted. during transmission, error signals are sampled and data re-transmitted whenever an error signal is detected. ds d0 d1 d2 d3 d4 d5 d6 d7 dp with no parity error transmitting station output ds d0 d1 d2 d3 d4 d5 d6 d7 dp de with parity error transmitting station output receiving station output ds: d0Cd7: dp: de: start bit data bits parity bit error signal figure 15.3 data format for smart card interface the operating sequence is: 1. the data line is high impedance when not in use and is fixed high with a pull-up resistor. 2. the transmitting side starts one frame of data transmission. the data frame starts with a start bit (ds, low level). the start bit is followed by eight data bits (d0Cd7) and a parity bit (dp). 3. on the smart card interface, the data line returns to high impedance after this. the data line is pulled high with a pull-up resistor. 4. the receiving side checks parity. when the data is received normally with no parity errors, the receiving side then waits to receive the next data. when a parity error occurs, the receiving side outputs an error signal (de, low level) and requests re-transfer of data. the receiving station returns the signal line to high impedance after outputting the error signal for a specified period. the signal line is pulled high with a pull-up resistor.
521 5. the transmitting side transmits the next frame of data unless it receives an error signal. if it does receive an error signal, it returns to step 2 to re-transmit the erroneous data. 15.3.4 register settings table 15.3 shows the bit map of the registers that the smart card interface uses. bits shown as 1 or 0 must be set to the indicated value. the settings for the other bits are described below. table 15.3 register settings for the smart card interface register address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scsmr h'fffffe80 c/ a 01o/ e 1 0 cks1 cks0 scbrr h'fffffe82 brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 scscr h'fffffe84 tie rie te re 0 0 cke1 cke0 sctdr h'fffffe86 tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 scssr h'fffffe88 tdre rdrf orer fer/ ers per tend 0 0 scrdr h'fffffe8a rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 scscmr h'fffffe8c sdir sinv smif note: dashes indicate unused bits. 1. setting the serial mode register (scsmr): the c/ a bit selects the set timing of the tend flag, and selects the clock output state with the combination of bits cke1 and cke0 in the serial control register (scscr). set the o/ e bit to 0 when the ic card uses the direct convention or to 1 when it uses the inverse convention. select the on-chip baud rate generator clock source with the cks1 and cks0 bits (see section 15.3.5, clock). 2. setting the bit rate register (scbrr): set the bit rate. see section 15.3.5, clock, to see how to calculate the set value. 3. setting the serial control register (scscr): the tie, rie, te and re bits function as they do for the ordinary sci. see section 14, serial communication interface (sck), for more information. the cke0 bit specifies the clock output. when no clock is output, set 0; when a clock is output, set 1. 4. setting the smart card mode register (scscmr): the sdir and sinv bits are both set to 0 for ic cards that use the direct convention and both to 1 when the inverse convention is used. the smif bit is set to 1 for the smart card interface. figure 15.4 shows sample waveforms for register settings of the two types of ic cards (direct convention and inverse convention) and their start characters.
522 in the direct convention type, the logical 1 level is state z, the logical 0 level is state a, and communication is lsb first. the start character data is h'3b. the parity bit is even (from the smart card standards), and thus 1. in the inverse convention type, the logical 1 level is state a, the logical 0 level is state z, and communication is msb first. the start character data is h'3f. the parity bit is even (from the smart card standards), and thus 0, which corresponds to state z. only data bits d7Cd0 are inverted by the sinv bit. to invert the parity bit, set the o/ e bit in scsmr to odd parity mode. this applies to both transmission and reception. ds d0 d1 d2 d3 d4 d5 d6 d7 dp a (z) z z a z z z a a z (z) state a. direct convention (sdir, sinv, and o/ e are all 0) ds d7 d6 d5 d4 d3 d2 d1 d0 dp a (z) z z a a a a a a z (z) state b. inverse convention (sdir, sinv, and o/ e are all 1) figure 15.4 waveform of start character 15.3.5 clock only the internal clock generated by the on-chip baud rate generator can be used as the communication clock in the smart card interface. the bit rate for the clock is set by the bit rate register (scbrr) and the cks1 and cks0 bits in the serial mode register (scsmr), and is calculated using the equation below. table 15.5 shows sample bit rates. if clock output is then selected by setting cke0 to 1, a clock with a frequency 372 times the bit rate is output from the sck0 pin. b = 10 6 1488 2 2nC1 (n + 1) p where: n = value set in scbrr (0 n 255) b = bit rate (bit/s)
523 p = peripheral module operating frequency (mhz) n = 0C3 (table 15.4) table 15.4 relationship of n to cks1 and cks0 n cks1 cks0 000 101 210 311 table 15.5 examples of bit rate b (bit/s) for scbrr settings (n = 0) p (mhz) n 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 0 9600.0 13440.9 14400.0 17473.1 19200.0 21505.4 24193.5 1 4800.0 6720.4 7200.0 8736.6 9600.0 10752.7 12096.8 2 3200.0 4480.3 4800.0 5824.4 6400.0 7168.5 8064.5 note: the bit rate is rounded to two decimal places. calculate the value to be set in the bit rate register (scbrr) from the operating frequency and the bit rate. n is an integer in the range 0 n 255, specifying a smallish error. n = 10 6 C 1 1488 2 2nC1 b p table 15.6 examples of scbrr settings for bit rate b (bit/s) (n = 0) (mhz) (9600 bits/s) 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 n error n error n error n error n error n error n error 0 0.00 1 30.00 1 25.00 1 8.99 1 0.00 1 12.01 2 15.99
524 table 15.7 maximum bit rates for frequencies (smart card interface mode) p (mhz) maximum bit rate (bit/s) n n 7.1424 9600 0 0 10.00 13441 0 0 10.7136 14400 0 0 13.00 17473 0 0 14.2848 19200 0 0 16.00 21505 0 0 18.00 24194 0 0 the bit rate error is found as follows: error (%) = ( 10 6 C 1) 100 1488 2 2nC1 b (n + 1) p table 15.8 shows the relationship between transmit/receive clock register set values and output states on the smart card interface. table 15.8 register set values and sck pin register value sck pin setting smif c/ a cke1 cke0 output state 1 * 1 1000 port determined by setting of port register scp1md1 and scp1md0 bits 1001 sck (serial clock) output state 2 * 2 1100 low output low output state 1101 sck (serial clock) output state 3 * 2 1110 high output high output state 1111 sck (serial clock) output state notes: * 1 the sck output state changes as soon as the cke0 bit is modified. the cke1 bit should be cleared to 0. * 2 the clock duty remains constant despite stopping and starting of the clock by modification of the cke0 bit.
525 15.3.6 data transmission and reception initialization: initialize the sci using the following procedure before sending or receiving data. initialization is also required for switching from transmit mode to receive mode or from receive mode to transmit mode. figure 15.5 shows a flowchart of the initialization process. 1. clear te and re in the serial control register (scscr) to 0. 2. clear error flags fer/ers, per, and orer to 0 in the serial status register (scssr). 3. set the c/ a bit, parity bit (o/ e bit), and baud rate generator select bits (cks1 and cks0 bits) in the serial mode register (scsmr). at this time also clear the chr and mp bits to 0 and set the stop and pe bits to 1. 4. set the smif, sdir, and sinv bits in the smart card mode register (scscmr). when the smif bit is set to 1, the txd and rxd pins both switch from ports to sci pins and become high impedance. 5. set the value corresponding to the bit rate in the bit rate register (scbrr). 6. set the clock source select bits (cke1 and cke0 bits) in the serial control register (scscr). clear the tie, rie, te, re, mpie, and teie bits to 0. when the cke0 bit is set to 1, a clock is output from the sck pin. 7. after waiting at least 1 bit, set the tie, rie, te, and re bits in scscr. do not set the te and re bits simultaneously unless performing auto-diagnosis.
526 initialize clear te and re bits in scscr to 0 set value in scbrr clear scssrs fer/ers, per and orer flags to 0 wait set scscrs tie, rie, te, and re bits has a 1-bit interval elapsed? end (2) set scsmrs o/ e bit to parity, set cks1 and cks0 bits to the clock and set c/ a (3) set scscrs cke1 and cke0 bits to the clock and clear tie, rie, te, re, mpie, and teie bits to 0 (6) (5) (4) (1) (7) no yes set scsmr's smif, sdir, and sinv bits note: numbers refer to the preceding procedure. figure 15.5 initialization flowchart (example)
527 serial data transmission: the processing procedures in the smart card mode differ from ordinary sci processing because data is retransmitted when an error signal is sampled during a data transmission. this results in the transmission processing flowchart shown in figure 15.6. 1. initialize the smart card interface mode as described in initialization above. 2. check that the fer/ers bit in scssr is cleared to 0. 3. repeat steps 2 and 3 until the tend flag in scssr is set to 1. 4. write the transmit data into sctdr, clear the tdre flag to 0 and start transmitting. the tend flag will be cleared to 0. 5. to transmit more data, return to step 2. 6. to end transmission, clear the te bit to 0. this processing can be interrupted. when the tie bit is set to 1 and interrupt requests are enabled, a transmit-data-empty interrupt (txi) will be requested when the tend flag is set to 1 at the end of the transmission. when the rie bit is set to 1 and interrupt requests are enabled, a communication error interrupt (eri) will be requested when the ers flag is set to 1 when an error occurs in transmission. see interrupt operation below for more information.
528 start end transmission start transmission initialize write transmit data in sctdr and clear tdre flag in scssr to 0 (1) clear te bit in scscr to 0 (6) error processing (2) fer/ers = 0? tend = 1? yes yes yes yes no no all data transmitted? no tend = 1? no error processing fer/ers = 0? yes no (4) (5) (3) note: numbers refer to the preceding procedure. figure 15.6 transmission flowchart
529 serial data reception: the processing procedures in the smart card mode are the same as in ordinary sci processing. the reception processing flowchart is shown in figure 15.7. 1. initialize the smart card interface mode as described above in initialization and in figure 15.5. 2. check that the orer and per flags in scssr are cleared to 0. if either flag is set, clear both to 0 after performing the appropriate error processing procedures. 3. repeat steps 2 and 3 until the rdrf flag is set to 1. 4. read the receive data from scrdr. 5. to receive more data, clear the rdrf flag to 0 and return to step 2. 6. to end reception, clear the re bit to 0. this processing can be interrupted. when the rie bit is set to 1 and interrupt requests are enabled, a receive-data-full interrupt (rxi) will be requested when the rdrf flag is set to 1 at the end of the reception. when an error occurs during reception and either the orer or per flag is set to 1, a communication error interrupt (eri) will be requested. see interrupt operation below for more information. the received data will be transferred to scrdr even when a parity error occurs during reception and per is set to 1, so this data can still be read.
530 start end reception start reception initialize write receive data from scrdr and clear rdrf flag in scssr to 0 (1) clear re bit in scscr to 0 (6) error processing (2) orer = 0 or per = 0? rdrf = 1? yes yes yes no no all data received? no (4) (5) (3) note: numbers refer to the preceding procedure. figure 15.7 reception flowchart (example)
531 switching modes: when switching from receive mode to transmit mode, check that the receive operation is completed before starting initialization and setting re to 0 and te to 1. the rdrf, per, and orer flags can be used to check if reception is completed. when switching from transmit mode to receive mode, check that the transmit operation is completed before starting initialization and setting te to 0 and re to 1. the tend flag can be used to check if transmission is completed. interrupt operation: in the smart card interface mode, there are three types of interrupts: transmit-data-empty (txi), communication error (eri) and receive-data-full (rxi). in this mode, the transmit-end interrupt (tei) cannot be requested. set the tend flag in scssr to 1 to request a txi interrupt. set the rdrf flag in scssr to 1 to request an rxi interrupt. set the orer, per, or fer/ers flag in scssr to 1 to request an eri interrupt (table 15.9). table 15.9 smart card mode operating state and interrupt sources mode state flag mask bit interrupt source transmit mode normal tend tie txi error fer/ers rie eri receive mode normal rdrf rie rxi error per, orer rie eri 15.4 usage notes when the sci is used as a smart card interface, be sure that all criteria in sections 15.4.1 and 15.4.2 are applied. 15.4.1 receive data timing and receive margin in asynchronous mode in asynchronous mode, the sci runs on a basic clock with a frequency of 372 times the transfer rate. during reception, the sci samples the falling of the start bit using the base clock to achieve internal synchronization. receive data is latched internally on the rising edge of the 186th basic clock cycle (figure 15.8).
532 0 185 371 0 185 371 0 base clock receive data (rxd) synchro- nization sampling timing data sampling timing 186 clock cycles 372 clock cycles start bit d0 d1 figure 15.8 receive data sampling timing in smart card mode the receive margin is found from the following equation: for smart card mode: m = (0.5 C ) 1 2n d C 0.5 n C (l C 0.5)f C (1 + f) 100% where: m = receive margin (%) n = ratio of bit rate to clock (n = 372) d = clock duty (d = 0 to 1.0) l = frame length (l = 10) f = absolute value of clock frequency deviation using this equation, the receive margin when f = 0 and d = 0.5 is as follows: m = (0.5 C 1/2 372) 100 % = 49.866 %
533 15.4.2 retransmission (receive and transmit modes) retransmission by the sci in receive mode: figure 15.9 shows the retransmission operation in the sci receive mode. 1. when the received parity bit is checked and an error is found, the per bit in scssr is automatically set to 1. if the rie bit in scscr is enabled at this time, an eri interrupt is requested. be sure to clear the per bit before the next parity bit is sampled. 2. the rdrf bit in scssr is not set in the frame that caused the error. 3. when the received parity bit is checked and no error is found, the per bit in scssr is not set. 4. when the received parity bit is checked and no error is found, reception is considered to have been completed normally and the rdrf bit in scssr is automatically set to 1. if the rie bit in scscr is enabled at this time, an rxi interrupt is requested. 5. when a normal frame is received, the pin maintains a three-state state when it transmits the error signal. d0 ds d2 d1 d4 d3 d6 d5 dp de d7 d0 ds d2 d1 d4 d3 d6 d5 dp (de) d7 d0 ds d2 d1 d4 d3 nth transfer frame rdrf per 2 1 4 5 3 retransmitted frame transfer frame n + 1 figure 15.9 retransmission in sci receive mode
534 retransmission by the sci in transmit mode: figure 15.10 shows the retransmission operation in the sci transmit mode. 1. after transmission of one frame is completed, the fer/ers bit in scssr is set to 1 when a error signal is returned from the receiving side. if the rie bit in scscr is enabled at this time, an eri interrupt is requested. be sure to clear the fer/ers bit before the next parity bit is sampled. 2. the tend bit in scssr is not set in the frame that received the error signal that indicated the error. 3. the fer/ers bit in scssr is not set when no error signal is returned from the receiving side. 4. when no error signal is returned from the receiving side, the tend bit in scssr is set to 1 when the transmission of the frame that includes the retransmission is considered completed. if the tie bit in scscr is enabled at this time, a txi interrupt will be requested. d0 ds d2 d1 d4 d3 d6 d5 dp de d7 d0 ds d2 d1 d4 d3 d6 d5 dp (de) d7 d0 ds d2 d1 d4 d3 nth transfer frame tend fer/ers transfer from tdr to trs transfer from tdr to trs transfer from tdr to trs 1 2 4 3 retransmitted frame transfer frame n + 1 tdre figure 15.10 retransmission in sci transmit mode 15.4.3 block transfer mode support this smart card interface conforms to the t = 0 (character transfer) protocols of iso/iec7816-3. as a result, this smart card interface does not support block transfer, in which error signals are neither sent nor detected, and data is not automatically retransmitted.
535 section 16 serial communication interface with fifo (scif) 16.1 overview this lsi has two-channel serial communication interface with fifo (scif) that supports asynchronous serial communication. it also has 16-stage fifo registers for both transfer and receive that enables this lsi efficient high-speed continuous communication. 16.1.1 features ? asynchronous serial communication: ? serial data communications are performed by start-stop in character units. the sci can communicate with a universal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other communications chip that employs a standard asynchronous serial system. there are eight selectable serial data communication formats. ? data length: seven or eight bits ? stop bit length: one or two bits ? parity: even, odd, or none ? receive error detection: parity and framing errors ? break detection: break is detected when the receive data next the generated framing error is the space level and has the framing error. it is also detected by reading the rxd level directly from the port sc data register (scpdr) when a framing error occurs ? full duplex communication: the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. both sections use 16-stage fifo buffering, so high-speed continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates ? internal or external transmit/receive clock source: from either baud rate generator (internal) or sck pin (external) ? four types of interrupts: transmit-fifo-data-empty, break, receive-fifo-data-full, and receive-error interrupts are requested independently. the direct memory access controller (dmac) can be activated to execute a data transfer by a transmit-fifo-data-empty or receive- fifo-data-full interrupt. ? when the scif is not in use, it can be stopped by halting the clock supplied to it, saving power. ? on-chip modem control functions ( rts2 and cts2 ) ? the quantity of data in the transmit and receive fifo registers and the number of receive errors of the receive data in the receive fifo register can be known. ? the time-out error (dr) can be detected in receiving.
536 16.1.2 block diagram figure 16.1 shows a block diagram of the sci. rxd2 txd2 sck2 scif scbrr2 scssr2 scscr2 scftdr2 sctsr2 scfrdr2 (16 (16 stages) stages) scrsr2 scsmr2 scfdr2 scfcr2 scpcr scfdr2 parity generation parity check clock external clock module data bus internal data bus p p /4 p /16 p /64 txi tei rxi bvri bus interface baud rate generator transmit/ receive control scrsr2: scfrdr2: sctsr2: scftdr2: scsmr2: scscr2: receive shift register receive fifo data register transmit shift register transmit fifo data register serial mode register serial control register scssr2: scbrr2: scfcr2: scfdr2: scpdr: scpcr: serial status register bit rate register fifo control register number of fifo data register port sc data register port sc control register legend: figure 16.1 scif block diagram
537 figures 16.2 to 16.4 show the scif i/o ports. scif pin i/o and data control is performed by bits 11C8 of scpcr and bits 5 and 4 of scpdr. for details, see section 14.2.8. internal data bus output enable clock input enable scif serial clock output serial clock input r scp5md0 pcrw reset c q q d r scp5md1 pcrw reset c qd r scp5dt1 pdrw reset scpt[5]/sck2 c d pdrw: scpdr write pdrr: pcrw: scpdr read scpcr write pdrr * note: * when reading the sck2 pin, clear the c/ a bit in scsmr2 and the cke1 and cke0 bits in scscr2 to 0, and set the scp5md1 bit in scspr to 1 (see section 14.2.8). legend: figure 16.2 scpt[5]/sck2 pin
538 internal data bus output enable scif serial transmission output q r scp4dt1 pdrw reset scpt[4]/txd2 c d pcrw: pdrw: scpcr write scpdr write r scp4md0 pcrw reset c q d r scp4md1 pcrw reset c qd legend: figure 16.3 scpt[4]/txd2 pin
539 scif serial receive data internal data bus pdrr * scpt[4]/rxd2 pdrr: scpdr read note: * when reading the rxd2 pin, set the re bit in scscr2 to 1. legend: figure 16.4 scpt[4]/rxd2 pin 16.1.3 pin configuration the scif has the serial pins summarized in table 16.1. table 16.1 scif pins pin name abbreviation i/o function serial clock pin sck2 i/o clock i/o receive data pin rxd2 input receive data input transmit data pin txd2 output transmit data output request to send pin rts2 output request to send clear to send pin cts2 input clear to send
540 16.1.4 register configuration table 16.2 summarizes the scif internal registers. these registers specify the data format and bit rate, and control the transmitter and receiver sections. table 16.2 registers register name abbreviation r/w initial value address access size serial mode register 2 scsmr2 r/w h'00 h'04000150 (h'a4000150) * 2 8 bits bit rate register 2 scbrr2 r/w h'ff h'04000152 (h'a4000152) * 2 8 bits serial control register 2 scscr2 r/w h'00 h'04000154 (h'a4000154) * 2 8 bits transmit fifo data register 2 scftdr2 w h'04000156 (h'a4000156) * 2 8 bits serial status register 2 scssr2 r/(w) * 1 h'0060 h'04000158 (h'a4000158) * 2 16 bits receive data fifo register 2 scfrdr2 r undefined h'0400015a (h'a400015a) * 2 8 bits fifo control register 2 scfcr2 r/w h'00 h'0400015c (h'a400015c) * 2 8 bits fifo data count set register 2 scfdr2 r h'0000 h'0400015e (h'a400015e) * 2 16 bits notes: these registers are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 only 0 can be written to clear the flag. * 2 when address translation by the mmu does not apply, the address in parentheses should be used. 16.2 register descriptions 16.2.1 receive shift register (scrsr2) the receive shift register (scrsr2) receives serial data. data input at the rxd2 pin is loaded into the scrsr2 in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to the scfrdr2, which is a receive fifo register. the cpu cannot read or write the scrsr2 directly.
541 bit: 7 6 5 4 3 2 1 0 r/w: 16.2.2 receive fifo data register (scfrdr2) the 16-byte receive fifo data register (scfrdr2) stores serial receive data. the scif completes the reception of one byte of serial data by moving the received data from the receive shift register (scrsr2) into the scfrdr2 for storage. continuous receive is enabled until 16 bytes are stored. the cpu can read but not write the scfrdr2. when data is read without received data in the receive fifo data register, the value is undefined. when the received data in this register becomes full, the subsequent serial data is lost. bit: 7 6 5 4 3 2 1 0 r/w: r r r r r r r r 16.2.3 transmit shift register (sctsr2) the transmit shift register (sctsr2) transmits serial data. the sci loads transmit data from the transmit fifo data register (scftdr2) into the sctsr2, then transmits the data serially from the txd2 pin, lsb (bit 0) first. after transmitting one data byte, the sci automatically loads the next transmit data from the scftdr2 into the sctsr2 and starts transmitting again. the cpu cannot read or write the sctsr2 directly. bit: 7 6 5 4 3 2 1 0 r/w: 16.2.4 transmit fifo data register (scftdr2) the transmit fifo data register (scftdr2) is a 16-byte 8-bit-length fifo register that stores data for serial transmission. when the scif detects that the transmit shift register (sctsr2) is empty, it moves transmit data written in the scftdr2 into the sctsr2 and starts serial transmission. continuous serial transmission is performed until the transmit data in the scftdr2 becomes empty. the cpu can always write to the scftdr2. when the transmit data in the scftdr2 is full (16 bytes), next data cannot be written. if attempted to write, the data is ignored.
542 bit: 7 6 5 4 3 2 1 0 r/w: w w w w w w w w 16.2.5 serial mode register (scsmr2) the serial mode register (scsmr2) is an eight-bit register that specifies the scif serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write the scsmr2. the scsmr2 is initialized to h'00 by a reset or in standby and module standby modes. bit: 7 6 5 4 3 2 1 0 chr pe o/ e stop cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r r/w r/w bit 7reserved: this bit is always read 0. the write value should always be 0. bit 6character length (chr): selects seven-bit or eight-bit data in the asynchronous mode. bit 6: chr description 0 eight-bit data. (initial value) 1 seven-bit data. (when seven-bit data is selected, the msb (bit 7) of the transmit fifo data register is not transmitted.) bit 5parity enable (pe): selects whether to add a parity bit to transmit data and to check the parity of receive data. bit 5: pe description 0 parity bit not added or checked. (initial value) 1 parity bit added and checked. when pe is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (o/ e ) setting. receive data parity is checked according to the even/odd (o/ e ) mode setting.
543 bit 4parity mode (o/ e ): selects even or odd parity when parity bits are added and checked. the o/ e setting is used only when the parity enable bit (pe) is set to 1 to enable parity addition and check. the o/ e setting is ignored when parity addition and check is disabled. bit 4: o/ e description 0 even parity. (initial value). if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1 odd parity. if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined. bit 3stop bit length (stop): selects one or two bits as the stop bit length. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. bit 3: stop description 0 one stop bit. (initial value) in transmitting, a single bit of 1 is added at the end of each transmitted character. 1 two stop bits. in transmitting, two bits of 1 are added at the end of each transmitted character. bit 2reserved: this bit is always read as 0. the write value should always be 0. bits 1 and 0clock select 1 and 0 (cks1, cks0): these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available. p , p /4, p /16 and p /64. for further information on the clock source, bit rate register settings, and baud rate, see section 16.2.8, bit rate register. bit 1: cks1 bit 0: cks0 description 00p (initial value) 1p /4 10p /16 1p /64 note: p : peripheral clock
544 16.2.6 serial control register (scscr2) the serial control register (scscr2) operates the sci transmitter/receiver, selects the serial clock output in the asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write the scscr2. the scscr2 is initialized to h'00 by a reset or in standby and module standby modes. bit: 7 6 5 4 3 2 1 0 tie rie te re cke1 cke0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7transmit interrupt enable (tie): enables or disables the transmit-fifo-data-empty interrupt (txi) requested when the serial transmit data is transferred from the transmit fifo data register (scftdr2) to transmit shift register (sctsr2), when the quantity of data in the transmit fifo register becomes less than the specified number of transmission triggers, and when the tdfe flag of the serial status register (scssr2) is set to1. bit 7: tie description 0 transmit-fifo-data-empty interrupt request (txi) is disabled. (initial value) the txi interrupt request can be cleared by writing the greater quantity of transmit data than the specified number of transmission triggers to scftdr2 and by clearing tdfe to 0 after reading 1 from tdfe, or can be cleared by clearing tie to 0. 1 transmit-fifo-data-empty interrupt request (txi) is enabled bit 6receive interrupt enable (rie): enables or disables the receive-data-full (rxi) and receive-error (eri) interrupts requested when the serial receive data is transferred from the receive shift register (scrsr2) to receive fifo data register (scfrdr2), when the quantity of data in the receive fifo register becomes more than the specified number of receive triggers, and when the rdrf flag of scssr2 is set to1.
545 bit 6: rie description 0 receive-data-full interrupt (rxi), receive-error interrupt (eri), and receive break interrupt (bri) requests are disabled. (initial value) rxi and eri interrupt requests can be cleared by reading the dr, er, or rdf flag after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. at rdf, read 1 from the rdf flag and clear it to 0, after reading the received data from scfrdr2 until the quantity of received data becomes less than the specified number of the receive triggers. 1 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are enabled. bit 5transmit enable (te): enables or disables the scif serial transmitter. bit 5: te description 0 transmitter disabled. (initial value) 1 transmitter enabled. serial transmission starts after writing of transmit data into the scftdr2. select the transmit format in the scsmr2 and scfcr2 and reset the scftdr2 before setting te to 1. bit 4receive enable (re): enables or disables the scif serial receiver. bit 4: re description 0 receiver disabled. (initial value) clearing re to 0 does not affect the receive flags (dr, er, brk, fer, and per). these flags retain their previous values. 1 receiver enabled. serial reception starts when a start bit is detected. select the receive format in the scsmr2 before setting re to 1. bits 3 and 2reserved: these bits are always read as 0. the write value should always be 0. bits 1 and 0clock enable 1 and 0 (cke1, cke0): these bits select the sci clock source and enable or disable clock output from the sck2 pin. depending on the combination of cke1 and cke0, the sck2 pin can be used for serial clock output or serial clock input. the cke0 setting is valid only when the sci is operating with the internal clock (cke1 = 0). the cke0 setting is ignored when an external clock source is selected (cke1 = 1). before selecting the scif operating mode in the serial mode register (scsmr2), set cke1 and cke0. for further details on selection of the sci clock source, see table 16.8 in section 16.3, operation.
546 bit 1: cke1 bit 0: cke0 description 0 0 internal clock, sck2 pin used for input pin (input signal is ignored) (initial value) 1 internal clock, sck2 pin used for clock output * 1 1 0 external clock, sck2 pin used for clock input * 2 1 external clock, sck2 pin used for clock input * 2 notes: * 1 the output clock frequency is 16 times the bit rate. * 2 the input clock frequency is 16 times the bit rate. 16.2.7 serial status register (scssr2) the serial status register (scssr2) is a 16-bit register. the upper 8 bits indicate the number of receive errors in the data of the scfrdr2, and the lower 8 bits indicate sci operating state. the cpu can always read and write the scssr2, but cannot write 1 in the status flags (er, tend, tdfe, brk, oper, and dr). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 3 (fer) and 2 (per) are read-only bits that cannot be written. the scssr2 is initialized to h'0060 by a reset or in standby and module standby modes. lower 8 bits: 7 6 5 4 3 2 1 0 er tend tdfe brk fer per rdf dr initial value: 0 1 1 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r r r/(w) * r/(w) * note: * the only value that can be written is 0 to clear the flag.
547 bit 7receive error (er): indicates that a parity error has occurred when received data includes a framing error or a parity. * 1 bit 7: er description 0 receive is in progress, or receive is normally completed. (initial value) er is cleared to 0 when the chip is reset or enters standby mode, or when 0 is written after 1 is read from er. 1 a framing error or a parity error has occurred. er is set to 1 when the stop bit is 0 after checking whether or not the last stop bit of the received data is 1 at the end of one-data receive * 2 , or when the total number of 1's in the received data and in the parity bit does not match the even/odd parity specification specified by the o/ e bit of the scsmr2. notes: * 1 clearing the re bit to 0 in scscr2 does not affect the er bit, which retains its previous value. even if a receive error occurs, the received data is transferred to scfrdr2 and the receive operation is continued. whether or not the data read from scfrdr2 includes a receive error can be detected by the fer and per bits of scssr2. * 2 in the stop mode, only the first stop bit is checked; the second stop bit is not checked. bit 6transmit end (tend): indicates that when the last bit of a serial character was transmitted, the scftdr2 did not contain valid data, so transmission has ended. bit 6: tend description 0 transmission is in progress. tend is cleared to 0 when data is written in scftdr2. 1 end of transmission. (initial value) tend is set to 1 when the chip is reset or enters standby mode, te is cleared to 0 in the serial control register (scscr2), or when scftdr2 does not contain received data when the last bit of a one-byte serial character is transmitted.
548 bit 5transmit fifo data empty (tdfe): indicates that data is transferred from transmit fifo data register (scftdr2) to transmit shift register (sctsr2), the quantity of data in scftdr2 becomes less than the number of transmission triggers specified by the ttrg1 and ttrg0 bits in fifo control register (scfcr2), and writing the transmit data to scftdr2 is enabled. bit 5: tdfe description 0 the quantity of transmit data written to scftdr2 is greater than the specified number of transmission triggers. (initial value) tdfe is cleared to 0 when the data exceeding the specified number of transmission triggers is written to scftdr2, software reads tdfe after it has been set to 1, then writes 0 in tdfe. 1 the quantity of transmit data in scftdr2 is less than the specified number of transmission triggers. * tdfe is set to 1 at reset or at standby mode, or when the quantity of transmission data in scftdr2 becomes less than the specified number of transmission triggers as a result of transmission. note: * since scftdr2 is a 16-byte fifo register, the maximum quantity of data which can be written when tdfe is 1 is "16 minus the specified number of transmission triggers". if attempted to write additional data, the data is ignored. the quantity of data in scftdr2 is indicated by the upper 8 bits of scftdr2. bit 4break detection (brk): indicates that a break signal is detected in received data. bit 4: brk description 0 no break signal is being received. (initial value) brk is cleared to 0 when the chip is reset or enters standby mode, or software reads brk after it has been set to 1, then writes 0 in brk. 1 the break signal is received. brk is set to 1 when data including a framing error is received and a framing error occurs with space 0 in the subsequent received data. note: when a break is detected, transfer of the received data (h'00) to scfrdr2 stops after detection. when the break ends and the receive signal becomes mark 1, the transfer of the received data resumes. the received data of a frame in which a break signal is detected is transferred to scfrdr2. after this, however, no received data is transferred until a break ends with the received signal being mark 1 and the next data is received.
549 bit 3framing error (fer): indicates a framing error in the data read from the receive fifo data register (scfrdr2). bit 3: fer description 0 no receive framing error occurred in the data read from scfrdr2.(initial value) fer is cleared to 0 when the chip is power-on reset or enters standby mode, or when no framing error is present in the data read from scfrdr2. 1 a receive framing error occurred in the data read from scfrdr2. fer is set to 1 when a framing error is present in the data read from scfrdr. bit 2parity error (per): indicates a parity error in the data read from the receive fifo data register (scfrdr2). bit 2: per description 0 no receive parity error occurred in the data read from scfrdr2. (initial value) per is cleared to 0 when the chip is power-on reset or enters standby mode, or when no parity error is present in the data read from scfrdr2. 1 a receive framing error occurred in the data read from scfrdr2. per is set to 1 when a parity error is present in the data read from scfrdr2. bit 1receive fifo data full (rdf): indicates that received data is transferred to the receive fifo data register (scfrdr2), the quantity of data in scfrdr2 becomes more than the number of receive triggers specified by the rtrg1 and rtrg0 bits in fifo control register (scfcr2). bit 1: rdf description 0 the quantity of transmit data written to scfrdr2 is less than the specified number of receive triggers. (initial value) rdf is cleared to 0 at power-on reset or at standby mode, or cleared when the scfrdr2 is read until the quantity of receive data in scfrdr2 becomes less than the specified number of receive triggers, when 1 is read from rdf, and 0 is then written. 1 the quantity of receive data in scfrdr2 is more than the specified number of receive triggers. rdf is set to 1 when the quantity of receive data which is greater than the specified number of receive triggers is stored in scfrdr2. * note: * since scftdr2 is a 16-byte fifo register, the maximum quantity of data which can be read when rdf is 1 is the specified number of receive triggers. if attempted to read after all data in the scfrdr2 have been read, the data is undefined. the quantity of receive data in scfrdr2 is indicated by the lower 8 bits of scftdr2.
550 bit 0receive data ready (dr): indicates that the receive fifo data register (scfrdr2) stores the data which is less than the specified number of receive triggers, and that next data is not yet received after 15 etu has elapsed from the last stop bit. bit 0: dr description 0 receive is in progress, or no received data remains in scfrdr2 after completing receive normally. (initial value) dr is cleared to 0 when the chip is power-on reset or enters standby mode, or software reads dr after it has been set to 1, then writes 0 in dr. 1 next receive data is not received. dr is set to 1 when scfrdr2 stores the data which is less than the specified number of receive triggers, and that next data is not yet received after 15 etu has elapsed from the last stop bit. * note: * this is equivalent to 1.5 frames with the 8-bit 1-stop-bit format. (etu: element time unit) upper 8 bits: 15 14 13 12 11 10 9 8 per3 per2 per1 per0 fer3 fer2 fer1 fer0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bits 15 to 12number of parity errors 3 to 0 (per3 to per0): indicates the quantity of data including a parity error in the received data stored in the receive fifo data register (scfrdr2). the value indicated by the bits 15 to 12 represents the number of parity errors in scfrdr2. bits 11 to 8number of framing errors 3 to 0 (fer3 to fer0): indicates the quantity of data including a framing error in the received data stored in scfrdr2. the value indicated by bits 11 to 8 represents the number of framing errors in scfrdr2.
551 16.2.8 bit rate register (scbrr2) the bit rate register (scbrr2) is an eight-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the serial mode register (scsmr2), determines the serial transmit/receive bit rate. the cpu can always read and write the scbrr2. the scbrr2 is initialized to h'ff by a reset or in module standby or standby mode. each channel has independent baud rate generator control, so different values can be set in two channels. bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the scbrr2 setting is calculated as follows: asynchronous mode: n = p 64 2 2n C 1 b 10 6 C 1 b: bit rate (bit/s) n: scbrr2 setting for baud rate generator (0 n 255) p : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 16.3.) table 16.3 scsmr2 settings scsmr2 settings n clock source cks1 cks0 0p 00 1p /4 0 1 2p /16 1 0 3p /64 1 1 note: find the bit rate error by the following formula: error (%) = p? 10 6 C 1 100 (n+1) 64 2 2nC1 b
552 table 16.4 lists examples of scbrr2 settings. table 16.4 bit rates and scbrr2 settings p (mhz) 2 2.097152 2.4576 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 1 141 0.03 1 148 C0.04 1 174 C0.26 150 1 103 0.16 1 108 0.21 1 127 0.00 300 0 207 0.16 0 217 0.21 0 255 0.00 600 0 103 0.16 0 108 0.21 0 127 0.00 1200 0 51 0.16 0 54 C0.70 0 63 0.00 2400 0 25 0.16 0 26 1.14 0 31 0.00 4800 0 12 0.16 0 13 C2.48 0 15 0.00 9600 0 6 C6.99 0 6 C2.48 0 7 0.00 19200 0 2 8.51 0 2 13.78 0 3 0.00 31250 0 1 0.00 0 1 4.86 0 1 22.88 38400 0 1 C18.62 0 0 C14.67 0 1 0.00 p (mhz) 3 3.6864 4 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 1 212 0.03 2 64 0.70 2 70 0.03 150 1 155 0.16 1 191 0.00 1 207 0.16 300 1 77 0.16 1 95 0.00 1 103 0.16 600 0 155 0.16 0 191 0.00 0 207 0.16 1200 0 77 0.16 0 95 0.00 0 103 0.16 2400 0 38 0.16 0 47 0.00 0 51 0.16 4800 0 19 C2.34 0 23 0.00 0 25 0.16 9600 0 9 C2.34 0 11 0.00 0 12 0.16 19200 0 4 C2.34 0 5 0.00 0 6 C6.99 31250 0 2 0.00 0 3 C7.84 0 3 0.00 38400 0 2 0.00 0 2 8.51
553 table 16.4 bit rates and scbrr2 settings (cont) p (mhz) 4.9152 5 6 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 86 0.31 2 88 C0.25 2 106 C0.44 150 1 255 0.00 2 64 0.16 2 77 0.16 300 1 127 0.00 1 129 0.16 1 155 0.16 600 0 255 0.00 1 64 0.16 1 77 0.16 1200 0 127 0.00 0 129 0.16 0 155 0.16 2400 0 63 0.00 0 64 0.16 0 77 0.16 4800 0 31 0.00 0 32 C1.36 0 38 0.16 9600 0 15 0.00 0 15 1.73 0 19 C2.34 19200 0 7 0.00 0 7 1.73 0 9 C2.34 31250 0 4 C1.70 0 4 0.00 0 5 0.00 38400 0 3 0.00 0 3 1.73 0 4 C2.34 p (mhz) 6.144 7.3728 8 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 108 0.08 2 130 C0.07 2 141 0.03 150 2 79 0.00 2 95 0.00 2 103 0.16 300 1 159 0.00 1 191 0.00 1 207 0.16 600 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 2.40 0 6 5.33 0 7 0.00 38400 0 4 0.00 0 5 0.00 0 6 C6.99
554 table 16.4 bit rates and scbrr2 settings (cont) p (mhz) 9.8304 10 12 12.288 bit rate (bits/s) n n error ( % )n n error ( % )n n error ( % )n n error ( % ) 110 1 174 C0.26 2 177 C0.25 1 212 0.03 2 217 0.08 150 1 127 0.00 2 129 0.16 1 155 0.16 2 159 0.00 300 0 255 0.00 2 64 0.16 1 77 0.16 2 79 0.00 600 0 127 0.00 1 129 0.16 0 155 0.16 1 159 0.00 1200 0 255 0.00 1 64 0.16 0 77 0.16 1 79 0.00 2400 0 127 0.00 0 129 0.16 0 38 0.16 0 159 0.00 4800 0 63 0.00 0 64 0.16 0 19 0.16 0 79 0.00 9600 0 31 0.00 0 32 C1.36 0 9 0.16 0 39 0.00 19200 0 15 0.00 0 15 1.73 0 4 0.16 0 19 0.00 31250 0 9 C1.70 0 9 0.00 0 2 0.00 0 11 2.40 38400 0 1 0.00 0 7 1.73 0 9 C2.34 0 9 0.00 p (mhz) 14.7456 16 19.6608 20 bit rate (bits/s) n n error ( % )n n error ( % )n n error ( % )n n error ( % ) 110 3 64 0.70 3 70 0.03 3 86 0.31 3 88 C0.25 150 2 191 0.00 2 207 0.16 2 255 0.00 2 64 0.16 300 2 95 0.00 2 103 0.16 2 127 0.00 2 129 0.16 600 1 191 0.00 1 207 0.16 1 255 0.00 1 64 0.16 1200 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 2400 0 191 0.00 0 207 0.16 0 255 0.00 0 64 0.16 4800 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 9600 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 19200 0 23 0.00 0 25 0.16 0 31 0.00 0 32 C1.36 31250 0 14 C1.70 0 15 0.00 0 19 C1.70 0 19 0.00 38400 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 115200 0 3 0.00 0 3 8.51 0 4 6.67 0 4 8.51 500000 0 0 C7.84 0 0 0.00 0 0 22.9 0 0 25.0
555 table 16.4 bit rates and scbrr2 settings (cont) p (mhz) 24 24.576 28.7 30 bit rate (bits/s) n n error ( % )n n error ( % )n n error ( % )n n error ( % ) 110 3 106 C0.44 3 108 0.08 3 126 0.31 3 132 0.13 150 3 77 0.16 3 79 0.00 3 92 0.46 3 97 C0.35 300 2 155 0.16 2 159 0.00 2 186 C0.08 2 194 0.16 600 2 77 0.16 2 79 0.00 2 92 0.46 2 97 C0.35 1200 1 155 0.16 1 159 0.00 1 186 C0.08 1 194 0.16 2400 1 77 0.16 1 79 0.00 1 92 0.46 1 97 C0.35 4800 0 155 0.16 0 159 0.00 0 186 C0.08 0 194 C1.36 9600 0 77 0.16 0 79 0.00 0 92 0.46 0 97 C0.35 19200 0 38 0.16 0 39 0.00 0 46 C0.61 0 48 C0.35 31250 0 23 0.00 0 24 C1.70 0 28 C1.03 0 29 0.00 38400 0 19 C2.34 0 19 0.00 0 22 1.55 0 23 1.73 115200 0 6 C6.99 0 6 C4.76 0 7 C2.68 0 7 1.73 500000 0 1 C25.0 0 1 C23.2 0 1 C10.3 0 1 C6.25
556 table 16.5 indicates the maximum bit rates in the asynchronous mode when the baud rate generator is being used. table 16.6 list the maximum rates for external clock input. table 16.5 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p (mhz) maximum bit rate (bits/s) n n 2 62500 0 0 2.097152 65536 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 8 250000 0 0 9.8304 307200 0 0 12 375000 0 0 14.7456 460800 0 0 16 500000 0 0 19.6608 614400 0 0 20 625000 0 0 24 750000 0 0 24.576 768000 0 0 28.7 896875 0 0 30 937500 0 0
557 table 16.6 maximum bit rates during external clock input (asynchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 2 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 8 2.0000 125000 9.8304 2.4576 153600 12 3.0000 187500 14.7456 3.6864 230400 16 4.0000 250000 19.6608 4.9152 307200 20 5.0000 312500 24 6.0000 375000 24.576 6.1440 384000 28.7 7.1750 448436 30 7.5000 468750
558 16.2.9 fifo control register (scfcr2) bit: 7 6 5 4 3 2 1 0 rtrg1 rtrg0 ttrg1 ttrg0 mce tfrst rfrst loop initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the fifo control register (scfcr2) resets the number of data in the transmit and receive fifo registers, sets the number of trigger data, and contains the permit bit for the loop back test. the scfcr2 is always read and written by the cpu. it is initialized to h'00 by the reset, the module standby function, or in the standby mode. bits 7 and 6trigger of the number of receive fifo data (rtrg1, rtrg0): set the number of receive data which sets the receive data full (rdf) flag in the serial status register (scssr2). these bits set the rdf flag when the number of receive data stored in the receive fifo register (scfrdr2) is increased more than the number of setting triggers listed below. bit 7: rtrg1 bit 6: rtrg0 number of received triggers 001 * 014 108 1114 note: * initial state. bits 5 and 4trigger of the number of transmit fifo data (ttrg1, ttrg0): set the number of remaining transmit data which sets the transmit fifo data register empty (tdfe) flag in the serial status register (scssr2). these bits set the tdfe flag when the number of transmit data in the transmit fifo data register (scftdr2) is decreased less than the number of setting triggers listed below. bit 5: ttrg1 bit 4: ttrg0 number of transmitted triggers 0 0 8 (8) * 0 1 4 (12) 1 0 2 (14) 1 1 1 (15) note: * initial state. values in brackets mean the number of empty scftdr2 when a flag occurs.
559 bit 3modem control enable (mce): enables the modem control signals cts2 and rts2 . bit 3: mce description 0 disables the modem signal * (initial state) 1 enables the modem signal note: * the cts2 is fixed to active 0 regardless of the input value, and the rts2 is also fixed to 0. bit 2transmit fifo data register reset (tfrst): disables the transmit data in the transmit fifo data register and resets the data to the empty state. bit 2: tfrst description 0 disables reset operation * (initial state) 1 enables reset operation note: * reset is operated in resets or the standby mode. bit 1receive fifo data register reset (rfrst): disables the receive data in the receive fifo data register and resets the data to the empty state. bit 1: rfrst description 0 disables reset operation * (initial state) 1 enables reset operation note: * reset is operated in resets or the standby mode. bit 0loop back test (loop): internally connects the transmit output pin (txd2) and receive input pin (rxd2) and enables the loop back test. bit 0: loop description 0 disables the loop back test (initial state) 1 enables the loop back test
560 16.2.10 fifo data count set register (scfdr2) the scfdr2 is a 16-bit register which indicates the number of data stored in the transmit fifo data register (scftdr2) and the receive fifo data register (scfrdr2). it indicates the number of transmit data in the scftdr2 with the upper eight bits, and the number of receive data in the scfrdr2 with the lower eight bits. the scfdr2 is always read from the cpu. lower 8 bits: 7 6 5 4 3 2 1 0 r4r3r2r1r0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r the scfdr2 indicates the number of receive data stored in the scfrdr2. the h'00 means no receive data, and the h'10 means that the full of receive data are stored in the scfrdr2. upper 8 bits: 15 14 13 12 11 10 9 8 t4t3t2t1t0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r the scfdr2 indicates the number of non-transmitted data stored in the scftdr2. the h'00 means no transmit data, and the h'10 means that the full of transmit data are stored in the scftdr2.
561 16.3 operation 16.3.1 overview for serial communication, the scif has an asynchronous mode in which characters are synchronized individually. refer to section 14.3.2, operation in asynchronous mode. the scif has the 16-byte fifo buffer for both transmit and receive, reduces an overhead of the cpu, and enables continuous high-speed communication. moreover, it has the rts and cts signals as the modem control signals. the transmission format is selected in the serial mode register (scsmr2), as listed in table 16.7. the sci clock source is selected by the combination of the cke1 and cke0 bits in the serial control register (scscr2), as listed in table 16.8. ? data length is selectable: seven or eight bits. ? parity and multiprocessor bits are selectable. so is the stop bit length (one or two bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing errors (fer), parity errors (per), receive fifo data full, receive data ready, and breaks. ? in transmitting, it is possible to detect transmit fifo data empty. ? the number of stored data for both the transmit and receive fifo registers is displayed. ? an internal or external clock can be selected as the scif clock source. ? when an internal clock is selected, the scif operates using the on-chip baud rate generator, and can output a serial clock signal with a frequency 16 times the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) table 16.7 scsmr2 settings and scif communication formats scsmr2 settings scif communication format mode bit 6 chr bit 5 pe bit 3 stop data length parity bit stop bit length asynchronous 0 0 0 8-bit not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits 1 0 0 7-bit not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits
562 table 16.8 scscr2 settings and scif clock source selection scscr2 settings scif transmit/receive clock mode bit 1 cke1 bit 0 cke0 clock source sck2 pin function asynchronous 0 0 internal scif does not use the sck2 pin mode 1 outputs a clock with a frequency 16 times the bit rate 1 0 external inputs a clock with frequency 16 times the 1 bit rate 16.3.2 serial operation transmit/receive formats: table 16.9 lists eight communication formats that can be selected. the format is selected by settings in the serial mode register (scsmr2). table 16.9 serial communication formats scsmr2 bits serial transmit/receive format and frame length chr pe stop 1 2345678 9 10 11 12 0 0 0 start 8-bit data stop 0 0 1 start 8-bit data stop stop 0 1 0 start 8-bit data p stop 0 1 1 start 8-bit data p stop stop 1 0 0 start 7-bit data stop 1 0 1 start 7-bit data stop stop 1 1 0 start 7-bit data p stop 1 1 1 start 7-bit data p stop stop start: start bit stop: stop bit p: parity bit
563 clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck2 pin can be selected as the scif transmit/receive clock. the clock source is selected by bits cke1 and cke0 in the serial control register (scscr2) (table 16.8). when an external clock is input at the sck2 pin, it must have a frequency equal to 16 times the desired bit rate. when the scif operates on an internal clock, it can output a clock signal at the sck2 pin. the frequency of this output clock is 16 times the bit rate. transmitting and receiving data (scif initialization): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr2), then initialize the scif as follows. when changing the communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 initializes the transmit shift register (sctsr2). clearing te and re to 0, however, does not initialize the serial status register (scssr2), transmit fifo data register (scftdr2), or receive fifo data register (scfrdr2), which retain their previous contents. clear te to 0 after all transmit data are transmitted and the tend flag in the scssr2 is set. the transmitting data enters the high impedance state after clearing to 0 although the bit can be cleared to 0 in transmitting. set the tfrst bit in the scfcr2 to 1 and reset the scftdr2 before te is set again to start transmission. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. scif operation becomes unreliable if the clock is stopped.
564 figure 16.5 is a sample flowchart for initializing the scif. the procedure for initializing the scif is: initialization 1. set the clock selection in scscr2. be sure to clear bits rie tie, te, and re to 0. when clock output is selected, it is output immediately after scscr2 settings are made. 2. set the data transfer format in scsmr2. 3. write a value corresponding to the bit rate into the bit rate register (scbrr2). (not necessary if an external clock is used.) 4. wait at least one bit interval, then set the te bit or re bit in scsr to 1. also set the rie and tie bits. setting the te and re bits enables the txd2 and rxd2 pins to be used. when transmitting, the scif will go to the mark state; when receiving, it will go to the idle state, waiting for a start bit. clear te and re bits in scscr2 to 0 set tfrst and rfrst bits in scfcr2 to 1 1-bit interval elapsed? set rtrg1-0, ttrg1-0, and mce in scfcr2 clear tfrst and rfrst bits to 0 set te and re bits in scscr2 to 1,and set rie, tie, teie, and mpie bits set data transfer format in scsmr2 yes no set value in scbrr2 set cke1 and cke0 bits in scscr2 (leaving te and re bits cleared to 0) end wait figure 16.5 sample scif initialization flowchart
565 ? serial data transmission figure 16.6 shows a sample flowchart for serial transmission. use the following procedure for serial data transmission after enabling the scif for transmission. start transmission read tdfe bit in scssr2 tend= 1? read tend bit in scssr2 clear te bit in scscr2 to 0 set scpdr and scpcr yes no tdfe= 1? no all data transmitted? no yes yes break output? yes no write transmit data (16 - transmit trigger set number) to scftdr2, read 1 from tdfe bit and tend flag in scssr2, then clear to 0 end of transmission 1. scif status check and transmit data write: read serial status register (scssr2) and check that the tdfe flag is set to 1, then write transmit data to the transmit fifo data register (scftdr2), read 1 from the tdfe and tend flags, then clear these flags to 0. the number of transmit data bytes that can be written is 16 - (transmit trigger set number). 2. serial transmission continuation procedure: to continue serial transmission, read 1 from the tdfe flag to confirm that writing is possible, then write data to scftdr2, and then clear the tdfe flag to 0. 3. break output at the end of serial transmission: to output a break in serial transmission, set the port sc data register (scpdr) and port sc control register (scpcr), then clear the te bit to 0 in the serial control register (scscr2). for information on scpdr and scpcr, see section 14.2.8. in steps 1 and 2, it is possible to ascertain the number of data bytes that can be written from the number of transmit data bytes in scftdr2 indicated by the upper 8 bits of the fifo data register (scfdr2). figure 16.6 sample serial transmission flowchart
566 in serial transmission, the scif operates as described below. 1. when data is written into the transmit fifo data register (scftdr2), the scif transfers the data from scftdr2 to the transmit shift register (sctsr2) and starts transmitting. confirm that the tdfe flag in the serial status register (scssr2) is set to 1 before writing transmit data to scftdr2. the number of data bytes that can be written is (16 C transmit trigger setting). 2. when data is transferred from scftdr2 to sctsr2 and transmission is started, consecutive transmit operations are performed until there is no transmit data left in scftdr2. when the number of transmit data bytes in scftdr2 falls below the transmit trigger number set in the fifo control register (scfcr2), the tdfe flag is set. if the tie bit in the serial control register (scscr2) is set to 1 at this time, a transmit-fifo-data-empty interrupt (txi) request is generated. the serial transmit data is sent from the txd2 pin in the following order. a. start bit: one-bit 0 is output. b. transmit data: 8-bit or 7-bit data is output in lsb-first order. c. parity bit: one parity bit (even or odd parity) is output. (a format in which a parity bit is not output can also be selected.) d. stop bit(s): one- or two-bit 1s (stop bits) are output. e. mark state: 1 is output continuously until the start bit that starts the next transmission is sent. 3. the scif checks the scftdr2 transmit data at the timing for sending the stop bit. if data is present, the data is transferred from scftdr2 to sctsr2, the stop bit is sent, and then serial transmission of the next frame is started. if there is no transmit data, the tend flag in scssr2 is set to 1, the stop bit is sent, and then the line goes to the mark state in which 1 is output continuously.
567 figure 16.7 shows an example of the operation for transmission. 01 1 1 0/1 0 1 tdfe tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idle state (mark state) txi interrupt request data written to scftdr2 and tdfe flag read as 1 then cleared to 0 by txi interrupt handler one frame d 0 d 1 d 7 d 0 d 1 d 7 0/1 txi interrupt request figure 16.7 example of transmit operation (example with 8-bit data, parity, one stop bit) 4. when modem control is enabled, transmission can be stopped and restarted in accordance with the cts2 input value. when cts2 is set to 1, if transmission is in progress, the line goes to the mark state after transmission of one frame. when cts2 is set to 0, the next transmit data is output starting from the start bit. figure 16.8 shows an example of the operation when modem control is used. 0 0/1 0 cts2 parity bit serial data txd2 start bit stop bit start bit d 0 d 1 d 7 d 0 d 1 d 7 0/1 rise this point before a stop bit figure 16.8 example of operation using modem control ( cts2 )
568 ? serial data reception figure 16.9 shows a sample flowchart for serial reception. use the following procedure for serial data reception after enabling the scif for reception. start reception read per, fer flags in scssr2 all data received? end reception no yes per = 1 or fer = 1? rdf = 1? yes yes clear re bit in scscr2 to 0 no no read rdf flag in scssr2 error processing read receive data in scfrdr2, and clear rdf flag in scssr2 to 0 1. receive error handling and break detection: read the dr, er, and brk flags in scssr2 to identify any error, perform the appropriate error handling, then clear the dr, er, and brk flags to 0. in the case of a framing error, a break can also be detected by reading the value of the rxd2 pin. 2. scif status check and receive data read : read the serial status register (scssr2) and check that rdf = 1, then read the receive data in the receive fifo data register (scfrdr2), read 1 from the rdf flag, and then clear the rdf flag to 0. the transition of the rdf flag from 0 to 1 can be identified by an rxi interrupt. 3. serial reception continuation procedure: to continue serial reception, read at least the receive trigger set number of receive data bytes from scfrdr2, read 1 from the rdf flag, then clear the rdf flag to 0. the number of receive data bytes in scfrdr2 can be ascertained by reading the lower bits of scfdr2. figure 16.9 sample serial reception flowchart (1)
569 error processing end brk= 1? dr= 1? er = 1? yes yes clear dr, er, brk flags in scssr2 to 0 no no no receive error processing break processing read receive data in scfrdr2 1. whether a framing error or parity error has occurred in the receive data read from scfrdr2 can be ascertained from the fer and per bits in scssr2. 2. when a break signal is received, receive data is not transferred to scfrdr2 while the brk flag is set. however, note that the last data in scfrdr2 is h'00 and the break data in which a framing error occurred is stored. figure 16.10 sample serial reception flowchart (2) in serial reception, the scif operates as described below. 1. the scif monitors the transmission line, and if a 0 start bit is detected, performs internal synchronization and starts reception. 2. the received data is stored in scrsr2 in lsb-to-msb order. 3. the parity bit and stop bit are received. after receiving these bits, the scif carries out the following checks. a. stop bit check: the scif checks whether the stop bit is 1. if there are two stop bits, only the first is checked. b. the scif checks whether receive data can be transferred from the receive shift register (scrsr2) to scfrdr2.
570 c. break check: the scif checks that the brk flag is 0, indicating that the break state is not set. if all the above checks are passed, the receive data is stored in scfrdr2. note: reception is not suspended when a receive error occurs. 4. if the rie bit in scscr2 is set to 1 when the rdf or dr flag changes to 1, a receive-fifo- data-full interrupt (rxi) request is generated. if the rie bit in scscr2 is set to 1 when the er flag changes to 1, a receive-error interrupt (eri) request is generated. if the rie bit in scscr2 is set to 1 when the brk flag changes to 1, a break reception interrupt (bri) request is generated. figure 16.11 shows an example of the operation for reception. rdf fer eri interrupt request generated by receive error one frame data read and rdf flag read as 1 then cleared to 0 by rxi interrupt handler rxi interrupt request 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idle state (mark state) d 0 d 1 d 7 d 0 d 1 d 7 0/1 figure 16.11 example of scif receive operation (example with 8-bit data, parity, one stop bit) 5. when modem control is enabled, the rts2 signal is output when scfrdr2 is empty. when rts2 is 0, reception is possible. when rts2 is 1, this indicates that scfrdr2 is full and reception is not possible. figure 16.12 shows an example of the operation when modem control is used.
571 0 0/1 0 1 rts2 parity bit serial data rxd2 start bit start d 0 d 1 d 2 d 7 figure 16.12 example of operation using modem control ( rts2 ) 16.4 scif interrupts the scif has four interrupt sources: transmit-fifo-data-empty (txi), receive-error (eri), receive-data-full (rxi), and break (bri). table 16.10 shows the interrupt sources and their order of priority. the interrupt sources are enabled or disabled by means of the tie and rie bits in scscr2. a separate interrupt request is sent to the interrupt controller for each of these interrupt sources. when the tdfe flag in the serial status register (scssr2) is set to 1, a txi interrupt request is generated. the dmac can be activated and data transfer performed when this interrupt is generated. the tdfe flag is automatically cleared to 0 when data is written to the transmit data register (scftdr2) by the dmac. when the rdf flag in scssr2 is set to 1, an rxi interrupt request is generated. the dmac can be activated and data transfer performed when the rdf flag in scssr2 is set to 1. the rdf flag is automatically cleared to 0 when data is read from the receive data register (scfrdr2) by the dmac. when the er flag in scssr2 is set to 1, an eri interrupt request is generated. when the brk flag in scssr2 is set to 1, a bri interrupt request is generated. the txi interrupt indicates that transmit data can be written, and the rxi interrupt indicates that there is receive data in scfrdr2.
572 table 16.10 scif interrupt sources interrupt source description dmac activation priority on reset release eri interrupt initiated by receive error flag (er) not possible high rxi interrupt initiated by receive data fifo full flag (rdf) or data ready flag (dr) possible (rdf only) bri interrupt initiated by break flag (brk) not possible txi interrupt initiated by transmit fifo data empty flag (tdfe) possible low see section 4, exception processing, for priorities and the relationship with non-scif interrupts. 16.5 notes on use note the following when using the scif. 1. scftdr2 writing and the tdfe flag: the tdfe flag in the serial status register (scssr2) is set when the number of transmit data bytes written in the transmit fifo data register (scftdr2) has fallen below the transmit trigger number set by bits ttrg1 and ttrg0 in the fifo control register (scfcr2). after tdfe is set, transmit data up to the number of empty bytes in scftdr2 can be written, allowing efficient continuous transmission. however, if the number of data bytes written in scftdr2 is equal to or less than the transmit trigger number, the tdfe flag will be set to 1 again after being read as 1 and cleared to 0. tdfe clearing should therefore be carried out when scftdr2 contains more than the transmit trigger number of transmit data bytes. the number of transmit data bytes in scftdr2 can be found from the upper 8 bits of the fifo data count register (scfdr2). 2. scfrdr2 reading and the rdf flag: the rdf flag in the serial status register (scssr2) is set when the number of receive data bytes in the receive fifo data register (scfrdr2) has become equal to or greater than the receive trigger number set by bits rtrg1 and rtrg0 in the fifo control register (scfcr2). after rdf is set, receive data equivalent to the trigger number can be read from scfrdr2, allowing efficient continuous reception. however, if the number of data bytes in scfrdr2 is equal to or greater than the trigger number, the rdf flag will be set to 1 again if it is cleared to 0. rdf should therefore be cleared to 0 after being read as 1 after all the receive data has been read. the number of receive data bytes in scfrdr2 can be found from the lower 8 bits of the fifo data count register (scfdr2).
573 3. break detection and processing: break signals can be detected by reading the rxd2 pin directly when a framing error (fer) is detected. in the break state the input from the rxd2 pin consists of all 0s, so the fer flag is set and the parity error flag (per) may also be set. note that, although transfer of receive data to scfrdr2 is halted in the break state, the scif receiver continues to operate, so if the brk flag is cleared to 0 it will be set to 1 again. 4. sending a break signal: the i/o condition and level of the txd2 pin are determined by the scp4dt bit in the port sc data register (scpdr) and bits scp4md0 and scp4md1 in the port sc control register (scpcr). this feature can be used to send a break signal. to send a break signal during serial transmission, clear the cp4dt bit to 0 (designating low level), then set the scp4md0 and scp4md1 bits to 0 and 1, respectively, and finally clear the te bit to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, and 0 is output from the txd2 pin. 5. tend flag and te bit processing: the tend flag is set to 1 during transmission of the stop bit of the last data. consequently, if the te bit is cleared to 0 immediately after setting of the tend flag has been confirmed, the stop bit will be in the process of transmission and will not be transmitted normally. therefore, the te bit should not be cleared to 0 for at least 0.5 serial clock cycles (or 1.5 cycles if two stop bits are used) after setting of the tend flag setting is confirmed. 6. receive data sampling timing and receive margin: the scif operates on a base clock with a frequency of 16 times the transfer rate. in reception, the scif synchronizes internally with the fall of the start bit, which it samples on the base clock. receive data is latched at the rising edge of the eighth base clock pulse. the timing is shown in figure 16.13. 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 base clock receive data (rxd2) synchro- nization sampling timing data sampling timing 8 clocks 16 clocks start bit C7.5 clocks +7.5 clocks d0 d1 figure 16.13 receive data sampling timing in asynchronous mode
574 the receive margin in asynchronous mode can therefore be expressed as shown in equation 1. equation 1: m = 0.5 C 1 2n d C 0.5 n C (l C 0.5) f C (1 + f) 100% m: receive margin (%) n: ratio of clock frequency to bit rate (n = 16) d: clock duty cycle (d = 0 to 1.0) l: frame length (l = 9 to 12) f: absolute deviation of clock frequency from equation 1, if f = 0 and d = 0.5, the receive margin is 46.875%, as given by equation 2. equation 2: when d = 0.5 and f = 0: m = (0.5 C 1/(2 16)) 100 % = 46.875 % this is a theoretical value. a reasonable margin to allow in system designs is 20% to 30%. 7. note on use of modem signals: the following bug may occur when modem signals are used by the scif (serial communication interface with fifo) (i.e. when the mce bit in scfcr2 is set to 1). ? conditions when, in transmission, the cts2 signal goes high when the last byte of data in the fifo has been transmitted. when the last byte of data in the fifo has been transmitted means the state in which there is data in sctsr2 only (and no data in scftdr2), and that data, including the start bit, has been output to txd2. it does not cover the case where the next data is written to scftdr2 before transmission of the last data is started. ? problem transmission may halt midway through a frame when the entire frame should be transmitted (from start bit to stop bit). in this case, a high level is output from txd2. ? preventive measures this bug can be avoided by taking the following measures. ? do not perform hard flow control with the cts2 signal. ? use an irq signal instead of the cts2 signal, and control starting and stopping of transmission by means of interrupt handling. ? perform transmission/reception with dummy data as the last data (in systems where this is permissible).
575 section 17 irda 17.1 overview this lsi has an on-chip infrared data association (irda) interface which is based on the irda 1.0 system and can perform infrared communication. it also can be used as the scif by setting registers. 17.1.1 features ? based on the irda 1.0 system ? asynchronous serial communication ? data length: eight bits ? stop bit length: one bit ? parity bit: none ? on-chip 16-stage fifo buffers for both transmit and receive ? on-chip baud rate generator with selectable bit rates ? guard functions not to affect the receiver in transmitting ? clock supply halted to reduce power consumption in using no irda
576 17.1.2 block diagram figure 17.1 shows a block diagram of the irda. scif clock input txd transfer clock rxd switching irda/scif irda sck txd1 rxd1 modulation unit demodulation unit scif: serial communication interface with fifo legend: figure 17.1 irda block diagram
577 figures 17.2 to 17.4 show the irda i/o port pins. scif pin i/o and data control is performed by bits 7C4 of scpcr and bits 3 and 2 of scpdr. for details, see section 14.2.8. internal data bus output enable clock input enable irda serial clock output serial clock input r scp3md0 pcrw reset c q q d r scp3md1 pcrw reset c qd r scp3dt1 pdrw reset scpt[3]/sck1 c d pdrw: scpdr write pdrr: pcrw: scpdr read scpcr write pdrr * note: * when reading the sck1 pin, the cke1 and cke0 bits in scscr to 0, and set the scp3md1 bit in scspr to 1 (see section 14.2.8). legend: figure 17.2 scpt[3]/sck1 pin
578 internal data bus output enable irda serial transfer output q r scp2dt1 pdrw reset scpt[2]/txd1 c d pcrw: pdrw: scpcr write scpdr write r scp2md0 pcrw reset c q d r scp2md1 pcrw reset c qd legend: figure 17.3 scpt[2]/txd1 pin
579 irda serial receive data internal data bus pdrr * scpt[2]/rxd1 pdrr: scpdr read note: * when reading the rxd1 pin, set the re bit in scscr to 1. legend: figure 17.4 scpt[2]/rxd1 pin 17.1.3pin configuration table 17.1 pin configuration pin name signal name i/o function serial clock pin sck1 i/o clock i/o receive data pin rxd1 input receive data input transmit data pin txd1 output transmit data output note: clock input from the serial clock pin cannot be set in irda mode.
580 17.1.4 register configuration the irda has internal registers shown in table 17.2. by using these registers, an irda or an scif mode, a data format, and a bit rate can be specified, and a transmit and a receive unit can be controlled. table 17.2 register configuration register name abbreviation r/w initial value address access size serial mode register 1 scsmr1 r/w h'00 h'04000140 (h'a4000140) * 2 8 bits bit rate register 1 scbrr1 r/w h'ff h'04000142 (h'a4000142) * 2 8 bits serial control register 1 scscr1 r/w h'00 h'04000144 (h'a4000144) * 2 8 bits transmit fifo data register 1 scftdr1 w h'04000146 (h'a4000146) * 2 8 bits serial status register 1 scssr1 r/(w) * 1 h'0060 h'04000148 (h'a4000148) * 2 16 bits receive data fifo register 1 scfrdr1 r undefined h'0400014a (h'a400014a) * 2 8 bits fifo control register 1 scfcr1 r/w h'00 h'0400014c (h'a400014c) * 2 8 bits fifo data count set register 1 scfdr1 r h'0000 h'0400014e (h'a400014e) * 2 16 bits notes: these registers are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 only 0 can be written to clear the flag. * 2 when address translation by the mmu does not apply, the address in parentheses should be used. 17.2 register description specifications of the registers in the irda are the same as those in the scif except for the serial mode register described below. therefore, refer to section 16, serial communication interface with fifo (scif), for these registers.
581 17.2.1 serial mode register (scsmr) scsmr is an 8-bit register, which can select an irda or an scif mode, specify an scif serial communication format, select an output pulse width of irda and select a baud rate generator clock source. this module operates as irda by setting the irmod bit to 1. at this time, bits 3 to 6 are fixed to 0. this register functions in the same way as the scsmr register in scif by setting the irmod bit to 0; therefore, this module can also operates as scif. bit: 7 6 5 4 3 2 1 0 irmod ick3 ick2 ick1 ick0 psel cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w scsmr is initialized to h'00 at power-on reset, manual reset, stop by module standby function, or standby mode. bit 7irda mode (irmod): this bit selects whether this module operates as an irda serial communication interface or as an scif. bit 7: irmod description 0 operates as an scif (initial value) 1 operates as an irda bits 6 to 3ir cck select bits (ick3Cick0): bit 2output pulse width select (psel) output pulse width select bit (psel) selects an output pulse width of irda that is 3/16 of bit length for 115 kbps or 3/16 of a bit length for selected baud rate. ir clock select bits should be set properly to fix an output pulse width to 3/16 of bit length for 115 kbps by setting psel bit to 1. bit 6: ick3 bit 5: ick2 bit 4: ick1 bit 3: ick0 bit 2: psel description ick3 ick2 ick1 ick0 1 pulse width: 3/16 of 115 kbps bit length dont care dont care dont care dont care 0 pulse width: 3/16 of a bit length it is necessary to generate a fixed clock pulse, irclk, by dividing p clock to 1/2n + 2 with a value n determined by setting of ick3Cick0.
582 example; p clock: 14.7456 mhz irclk: 921.6 khz (fixed) n: setting of ick3Cick0 (0 n 15) C 1 7 n p 2xirclk accordingly, n is 7. bits 1 and 0clock select 1 and 0 (cks1 and cks0): this bit selects an internal baud rate generator clock source. p , p /4, p /16, or p /64 can be selected by setting the cks1 and cks0 bits. refer to section 14.2.9, bit rate register (scbrr), for relationships among the clock source, the bit rate register set value, and the baud rate. bit 1: cks1 bit 0: cks0 description 00p clock (initial value) 01p /4 clock 10p /16 11p /64 note: peripheral clock 17.3operation description the irda module can perform a infrared communication conforming to irda 1.0 by connecting a infrared transmit/receive unit. a serial communication interface unit includes a 16-stage fifo buffer in a transmit unit and a receive unit, and therefore cpu overhead can be reduced and a high-speed communication can be successively performed. this module also supports dmac data transfer. the irda module differs from the scif in section 16 in that it does not include modem control signals rts and cts. refer to section 16.3, operation, for scif mode operation. 17.3.1 overview the irda module modifies txd/rxd transmit/receive data waveforms to satisfy the irda 1.0 specification of the infrared communication.
583 in the irda 1.0 specification, communication is first performed in the rate of 9600 bps, and the communication rate is changed. however, the communication rate cannot be automatically changed in this module, and therefore, perform communication by checking the communication rate and setting the appropriate rate in this module with software. note: in irda mode, reception cannot be performed when the te bit in the serial control register (scscr) is set to 1 (enabling transmission). when performing reception, clear the te bit in scscr to 0. as the sh7709a's rxd1 pin is active-high in irda mode, a (schmidt) inverter must be inserted when connecting an active-low irda module. the rxd1 pin is active-low in scif mode. 17.3.2 transmit as for the serial output signal (uart frame) from the scif, its waveforms are modified and the signal is converted into the ir frame serial output signal by the irda module, as shown in figure 17.5. when serial data is 0, the 3/16-bit width pulse of the ir frame is generated and output. when serial data is 1, a pulse is not output. the infrared led is driven with this signal that was demodulated into 3/16 width. 17.3.3 receive the 3/16-bit width pulse of the ir frame that was received is demodulated and converted into the uart frame, as shown in figure 17.5. demodulation to 0 is performed for pulse output, and demodulation to 1 is performed for no pulse output.
584 uart frame data ir frame data receive transmit stop bit stop bit start bit start bit bit cycle 3/16-bit cycle p ulse width 01 01 0 0 11 0 1 01 01 0 01 1 01 figure 17.5 transmit/receive operation
585 section 18 pin function controller 18.1 overview the pin function controller (pfc) is composed of registers for selecting the function of multiplexed pins and the direction of input/output. the pin function and i/o direction can be selected for each pin individually without regard to the operating mode of the lsi. table 18.1 lists the multiplexed pins. table 18.1 list of multiplexed pins port port function (related module) other function (related module) a pta7 i/o (port) d23 i/o (data bus) a pta6 i/o (port) d22 i/o (data bus) a pta5 i/o (port) d21 i/o (data bus) a pta4 i/o (port) d20 i/o (data bus) a pta3 i/o (port) d19 i/o (data bus) a pta2 i/o (port) d18 i/o (data bus) a pta1 i/o (port) d17 i/o (data bus) a pta0 i/o (port) d16 i/o (data bus) b ptb7 i/o (port) d31 i/o (data bus) b ptb6 i/o (port) d30 i/o (data bus) b ptb5 i/o (port) d29 i/o (data bus) b ptb4 i/o (port) d28 i/o (data bus) b ptb3 i/o (port) d27 i/o (data bus) b ptb2 i/o (port) d26 i/o (data bus) b ptb1 i/o (port) d25 i/o (data bus) b ptb0 i/o (port) d24 i/o (data bus) c ptc7 i/o (port)/pint7 input (intc) mcs7 output (bsc) c ptc6 i/o (port)/pint6 input (intc) mcs6 output (bsc) c ptc5 i/o (port)/pint5 input (intc) mcs5 output (bsc) c ptc4 i/o (port)/pint4 input (intc) mcs4 output (bsc) c ptc3 i/o (port)/pint3 input (intc) mcs3 output (bsc) c ptc2 i/o (port)/pint2 input (intc) mcs2 output (bsc) c ptc1 i/o (port)/pint1 input (intc) mcs1 output (bsc)
586 table 18.1 list of multiplexed pins (cont) port port function (related module) other function (related module) c ptc0 i/o (port)/pint0 input (intc) mcs0 output (bsc) d ptd7 i/o (port) dack1 output (dmac) d ptd6 input (port) dreq1 input (dmac) d ptd5 i/o (port) dack0 output (dmac) d ptd4 input (port) dreq0 input (dmac) d ptd3 i/o (port) wakeup output (wtc) d ptd2 i/o (port) resetout output d ptd1 i/o (port) drak0 output (dmac) d ptd0 i/o (port) drak1 output (dmac) e pte7 i/o (port) audsync output (aud) * 1 e pte6 i/o (port) cas2l output (bsc) e pte5 i/o (port) ce2b output (pcmcia) e pte4 i/o (port) ce2a output (pcmcia) e pte3 i/o (port) cas2h output (bsc) e pte2 i/o (port) ras3u output (bsc) e pte1 i/o (port) ras2u output (bsc) e pte0 i/o (port) tdo output (h-udi) * 1 f ptf7 input (port)/pint15 input (intc) trst input (aud, h-udi) * 2 f ptf6 input (port)/pint14 input (intc) tms input (h-udi) * 2 f ptf5 input (port)/pint13 input (intc) td1 input (h-udi) * 2 f ptf4 input (port)/pint12 input (intc) tck input (h-udi) * 2 f ptf3 input (port)/pint11 input (intc) irls3 input (intc) f ptf2 input (port)/pint10 input (intc) irls2 input (intc) f ptf1 input (port)/pint9 input (intc) irls1 input (intc) f ptf0 input (port)/pint8 input (intc) irls0 input (intc) g ptg7 input (port) iois16 input (pcmcia) g ptg6 input (port) asemd0 input (aud, h-udi) * 2 g ptg5 input (port) asebrkak output (aud) * 1 g ptg4 input (port) g ptg3 input (port) audata3 i/o (aud) * 1 g ptg2 input (port) audata2 i/o (aud) * 1
587 table 18.1 list of multiplexed pins (cont) port port function (related module) other function (related module) g ptg1 input (port) audata1 output (aud) * 1 g ptg0 input (port) audata0 output (aud) * 1 h pth7 i/o (port) tclk i/o input (tmu) h pth6 input (port) audck input (aud) * 1 h pth5 input (port) adtrg input (adc) h pth4 input (port)/irq4 input (intc) irq4 input (intc) h pth3 input (port)/irq3 input (intc) irq3 input (intc) h pth2 input (port)/irq2 input (intc) irq2 input (intc) h pth1 input (port)/irq1 input (intc) irq1 input (intc) h pth0 input (port)/irq0 input (intc) irq0 input (intc) j ptj7 i/o (port) status1 output (cpg) j ptj6 i/o (port) status0 output (cpg) j ptj5 i/o (port) cashh output (bsc) j ptj4 i/o (port) cashl output (bsc) j ptj3 i/o (port) caslh output (bsc)/ casu output (bsc) j ptj2 i/o (port) casll output (bsc)/ casl output (bsc) j ptj1 i/o (port) ras2l output (bsc) j ptj0 i/o (port) ras3l output (bsc) k ptk7 i/o (port) we3 output (bsc)/dqmuu output (bsc)/ iciowr output (bsc) k ptk6 i/o (port) we2 output (bsc)/dqmul output (bsc)/ iciord output (bsc) k ptk5 i/o (port) cke output (bsc) k ptk4 i/o (port) bs output (bsc) k ptk3 i/o (port) cs5 output (bsc)/ ce1a output (bsc) k ptk2 i/o (port) cs4 output (bsc) k ptk1 i/o (port) cs3 output (bsc) k ptk0 i/o (port) cs2 output (bsc) l ptl7 input (port) an7 input (adc)/da0 output (dac) l ptl6 input (port) an6 input (adc)/da1 output (dac) l ptl5 input (port) an5 input (adc)
588 table 18.1 list of multiplexed pins (cont) port port function (related module) other function (related module) l ptl4 input (port) an4 input (adc) l ptl3 input (port) an3 input (adc) l ptl2 input (port) an2 input (adc) l ptl1 input (port) an1 input (adc) l ptl0 input (port) an0 input (adc) scpt scpt7 input (port)/irq5 input (intc) cts2 input (uart ch 3)/irq5 input (intc) scpt scpt6 i/o (port) rts2 output (uart ch 3) scpt scpt5 i/o (port) sck2 i/o (uart ch 3) scpt scpt4 input (port) rxd2 input (uart ch 3) scpt4 output (port) txd2 output (uart ch 3) scpt scpt3 i/o (port) sck1 i/o (uart ch 2) scpt scpt2 input (port) rxd1 input (uart ch 2) scpt2 output (port) txd1 output (uart ch 2) scpt scpt1 i/o (port) sck0 i/o (uart ch 1) scpt scpt0 input (port) rxd0 input (uart ch 1) scpt0 output (port) txd0 output (uart ch 1) notes: scpt0, scpt2, and scpt4 have the same data register to be accessed although they have different input pins and output pins. * 1 for emulator use only * 2 for emulator or boundary scan use only
589 18.2 register configuration table 18.2 summarizes the registers of the pin function controller. table 18.2 pin function controller registers name abbreviation r/w initial value address access size port a control register pacr r/w h'0000 h'04000100 (h'a4000100) * 16 port b control register pbcr r/w h'0000 h'04000102 (h'a4000102) * 16 port c control register pccr r/w h'aaaa h'04000104 (h'a4000104) * 16 port d control register pdcr r/w h'aa8a h'04000106 (h'a4000106) * 16 port e control register pecr r/w h'aaaa/h'2aa8 h'04000108 (h'a4000108) * 16 port f control register pfcr r/w h'aaaa/h'00aa h'0400010a (h'a400010a) * 16 port g control register pgcr r/w h'aaaa/h'8200 h'0400010c (h'a400010c) * 16 port h control register phcr r/w h'aaaa/h'8aaa h'0400010e (h'a400010e) * 16 port j control register pjcr r/w h'0000 h'04000110 (h'a4000110) * 16 port k control register pkcr r/w h'0000 h'04000112 (h'a4000112) * 16 port l control register plcr r/w h'0000 h'04000114 (h'a4000114) * 16 sc port control register scpcr r/w h'a888 h'04000116 (h'a4000116) * 16 notes: 1. the initial value of the port e, f, g, and h control registers depends on the state of the asemd0 pin. if a low level is input at the asemd0 pin while the resetp pin is asserted, ase mode is entered; if a high level is input, normal mode is entered. see section 22, hitachi user debugging interface (h-udi), for more information on the h-udi. 2. these registers are located in area 1 of physical space. therefore, when the cache is enabled, either access these registers from the p2 area of virtual space or make an appropriate setting using the mmu so that these registers are not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
590 18.3 register descriptions 18.3.1 port a control register (pacr) port a control register (pacr) is a 16-bit read/write register that selects the pin functions. pacr is initialized to h'0000 by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pa7 md1 pa7 md0 pa6 md1 pa6 md0 pa5 md1 pa5 md0 pa4 md1 pa4 md0 pa3 md1 pa3 md0 pa2 md1 pa2 md0 pa1 md1 pa1 md0 pa0 md1 pa0 md0 initial value: 0000000000000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14 pa7 mode 1 and 0 (pa7md1, pa7md0) bits 13 and 12 pa6 mode 1 and 0 (pa6md1, pa6md0) bits 11 and 10 pa5 mode 1 and 0 (pa5md1, pa5md0) bits 9 and 8 pa4 mode 1 and 0 (pa4md1, pa4md0) bits 7 and 6 pa3 mode 1 and 0 (pa3md1, pa3md0) bits 5 and 4 pa2 mode 1 and 0 (pa2md1, pa2md0) bits 3 and 2 pa1 mode 1 and 0 (pa1md1, pa1md0) bits 1 and 0 pa0 mode 1 and 0 (pa0md1, pa0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): panmd1 bit 2n: panmd0 pin function 0 0 other function (see table 18.1) (initial value) 0 1 port output 1 0 port input (pullup mos: on) 1 1 port input (pullup mos: off) (n = 0 to 7)
591 18.3.2 port b control register (pbcr) port b control register (pbcr) is a 16-bit read/write register that selects the pin functions. pbcr is initialized to h'0000 by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pb7 md1 pb7 md0 pb6 md1 pb6 md0 pb5 md1 pb5 md0 pb4 md1 pb4 md0 pb3 md1 pb3 md0 pb2 md1 pb2 md0 pb1 md1 pb1 md0 pb0 md1 pb0 md0 initial value: 0000000000000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pb7 mode 1 and 0 (pb7md1, pb7md0) bits 13 and 12pb6 mode 1 and 0 (pb6md1, pb6md0) bits 11 and 10pb5 mode 1 and 0 (pb5md1, pb5md0) bits 9 and 8pb4 mode 1 and 0 (pb4md1, pb4md0) bits 7 and 6pb3 mode 1 and 0 (pb3md1, pb3md0) bits 5 and 4pb2 mode 1 and 0 (pb2md1, pb2md0) bits 3 and 2pb1 mode 1 and 0 (pb1md1, pb1md0) bits 1 and 0pb0 mode 1 and 0 (pb0md1, pb0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pbnmd1 bit 2n: pbnmd0 pin function 0 0 other function (see table 18.1) (initial value) 0 1 port output 1 0 port input (pullup mos: on) 1 1 port input (pullup mos: off) (n = 0 to 7)
592 18.3.3 port c control register (pccr) port c control register (pccr) is a 16-bit read/write register that selects the pin functions. pccr is initialized to h'aaaa by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pc7 md1 pc7 md0 pc6 md1 pc6 md0 pc5 md1 pc5 md0 pc4 md1 pc4 md0 pc3 md1 pc3 md0 pc2 md1 pc2 md0 pc1 md1 pc1 md0 pc0 md1 pc0 md0 initial value: 1010101010101010 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pc7 mode 1 and 0 (pc7md1, pc7md0) bits 13 and 12pb6 mode 1 and 0 (pc6md1, pc6md0) bits 11 and 10pc5 mode 1 and 0 (pc5md1, pc5md0) bits 9 and 8pc4 mode 1 and 0 (pc4md1, pc4md0) bits 7 and 6pc3 mode 1 and 0 (pc3md1, pc3md0) bits 5 and 4pc2 mode 1 and 0 (pc2md1, pc2md0) bits 3 and 2pc1 mode 1 and 0 (pc1md1, pc1md0) bits 1 and 0pc0 mode 1 and 0 (pc0md1, pc0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pcnmd1 bit 2n: pcnmd0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) (n = 0 to 7)
593 18.3.4 port d control register (pdcr) port d control register (pdcr) is a 16-bit read/write register that selects the pin functions. pdcr is initialized to h'aa8a by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pd7 md1 pd7 md0 pd6 md1 pd6 md0 pd5 md1 pd5 md0 pd4 md1 pd4 md0 pd3 md1 pd3 md0 pd2 md1 pd2 md0 pd1 md1 pd1 md0 pd0 md1 pd0 md0 initial value: 1010101010001010 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pd7 mode 1 and 0 (pd7md1, pd7md0) bits 11 and 10pd5 mode 1 and 0 (pd5md1, pd5md0) bits 7 and 6pd3 mode 1 and 0 (pd3md1, pd3md0) bits 5 and 4pd2 mode 1 and 0 (pd2md1, pd2md0) bits 3 and 2pd1 mode 1 and 0 (pd1md1, pd1md0) bits 1 and 0pd0 mode 1 and 0 (pd0md1, pd0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pdnmd1 bit 2n: pdnmd0 pin function 0 0 other function (see table 18.1) (initial value) (n = 2) 0 1 port output 1 0 port input (pullup mos: on) (initial value) (n = 0, 1, 3, 5, 7) 1 1 port input (pullup mos: off) (n = 0C3, 5, 7) bits 13 and 12pd6 mode 1 and 0 (pd6md1, pd6md0) bits 9 and 8pd4 mode 1 and 0 (pd4md1, pd4md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pdnmd1 bit 2n: pdnmd0 pin function 0 0 other function (see table 18.1) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) (n = 4, 6)
594 18.3.5 port e control register (pecr) port e control register (pecr) is a 16-bit read/write register that selects the pin functions. pecr is initialized to h'aaaa ( asemd0 = 1) or h'2aa8 ( asemd0 = 0) by power-on resets; however, it is not initialized by manual resets, in software standby mode, or in sleep mode. bit:1514131211109876543210 pe7 md1 pe7 md0 pe6 md1 pe6 md0 pe5 md1 pe5 md0 pe4 md1 pe4 md0 pe3 md1 pe3 md0 pe2 md1 pe2 md0 pe1 md1 pe1 md0 pe0 md1 pe0 md0 initial value: 1/0 01010101010101/00 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pe7 mode 1 and 0 (pe7md1, pe7md0) bits 13 and 12pe6 mode 1 and 0 (pe6md1, pe6md0) bits 11 and 10pe5 mode 1 and 0 (pe5md1, pe5md0) bits 9 and 8pe4 mode 1 and 0 (pe4md1, pe4md0) bits 7 and 6pe3 mode 1 and 0 (pe3md1, pe3md0) bits 5 and 4pe2 mode 1 and 0 (pe2md1, pe2md0) bits 3 and 2pe1 mode 1 and 0 (pe1md1, pe1md0) bits 1 and 0pe0 mode 1 and 0 (pe0md1, pe0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): penmd1 bit 2n: penmd0 pin function 0 0 reserved (n = 0, 7) (see table 18.1) (initial value) ( asemd0 = 0) 0 1 port output 1 0 port input (pullup mos: on) (initial value) ( asemd0 = 1) 1 1 port input (pullup mos: off) (n = 0, 7) bit (2n + 1): penmd1 bit 2n: penmd0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) (n = 1 to 6)
595 18.3.6 port f control register (pfcr) port f control register (pfcr) is a 16-bit read/write register that selects the pin functions. pfcr is initialized to h'aaaa ( asemd0 = 1) or h'00aa ( asemd0 = 0) by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pf7 md1 pf7 md0 pf6 md1 pf6 md0 pf5 md1 pf5 md0 pf4 md1 pf4 md0 pf3 md1 pf3 md0 pf2 md1 pf2 md0 pf1 md1 pf1 md0 pf0 md1 pf0 md0 initial value: 1/0 0 1/0 0 1/0 0 1/0 0 1 0 101010 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pf7 mode 1 and 0 (pf7md1, pf7md0) bits 13 and 12pf6 mode 1 and 0 (pf6md1, pf6md0) bits 11 and 10pf5 mode 1 and 0 (pf5md1, pf5md0) bits 9 and 8pf4 mode 1 and 0 (pf4md1, pf4md0) bits 7 and 6pf3 mode 1 and 0 (pf3md1, pf3md0) bits 5 and 4pf2 mode 1 and 0 (pf2md1, pf2md0) bits 3 and 2pf1 mode 1 and 0 (pf1md1, pf1md0) bits 1 and 0pf0 mode 1 and 0 (pf0md1, pf0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pfnmd1 bit 2n: pfnmd0 pin function 0 0 other function (see table 18.1) (initial value) ( asemd0 = 0) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) ( asemd0 = 1) 1 1 port input (pullup mos: off) (n = 4 to 7) bit (2n + 1): pfnmd1 bit 2n: pfnmd0 pin function 0 0 other function (see table 18.1) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) (n = 0 to 3)
596 18.3.7 port g control register (pgcr) port g control register (pgcr) is a 16-bit read/write register that selects the pin functions. pgcr is initialized to h'aaaa ( asemd0 = 1) or h'8200 ( asemd0 = 0) by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pg7 md1 pg7 md0 pg6 md1 pg6 md0 pg5 md1 pg5 md0 pg4 md1 pg4 md0 pg3 md1 pg3 md0 pg2 md1 pg2 md0 pg1 md1 pg1 md0 pg0 md1 pg0 md0 initial value: 1 0 1/0 0 1/0 0 1 0 1/0 0 1/0 0 1/0 0 1/0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pg7 mode 1 and 0 (pg7md1, pg7md0) bits 13 and 12pg6 mode 1 and 0 (pg6md1, pg6md0) bits 11 and 10pg5 mode 1 and 0 (pg5md1, pg5md0) bits 9 and 8pg4 mode 1 and 0 (pg4md1, pg4md0) bits 7 and 6pg3 mode 1 and 0 (pg3md1, pg3md0) bits 5 and 4pg2 mode 1 and 0 (pg2md1, pg2md0) bits 3 and 2pg1 mode 1 and 0 (pg1md1, pg1md0) bits 1 and 0pg0 mode 1 and 0 (pg0md1, pg0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pgnmd1 bit 2n: pgnmd0 pin function 0 0 other function (n = 0 to 3, 5), (see table 18.1) (initial value) ( asemd0 = 0) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) ( asemd0 = 1) 1 1 port input (pullup mos: off) (n = 0 to 3, 5) bit (2n + 1): pgnmd1 bit 2n: pgnmd0 pin function 0 0 other function (n = 6 or 7), (see table 18.1), reserved (n = 4) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) (n = 4, 6, 7)
597 18.3.8 port h control register (phcr) port h control register (phcr) is a 16-bit read/write register that selects the pin functions. phcr is initialized to h'aaaa ( asemd0 = 1) or h'8aaa ( asemd0 = 0) by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 ph7 md1 ph7 md0 ph6 md1 ph6 md0 ph5 md1 ph5 md0 ph4 md1 ph4 md0 ph3 md1 ph3 md0 ph2 md1 ph2 md0 ph1 md1 ph1 md0 ph0 md1 ph0 md0 initial value: 1 0 1/0 0101010101010 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14ph7 mode 1 and 0 (ph7md1, ph7md0): these bits select the pin functions and the input pullup mos control. bit 15: ph7md1 bit 14: ph7md0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) bits 13 and 12ph6 mode 1 and 0 (ph6md1, ph6md0) bits 11 and 10ph5 mode 1 and 0 (ph5md1, ph5md0) bits 9 and 8ph4 mode 1 and 0 (ph4md1, ph4md0) bits 7 and 6ph3 mode 1 and 0 (ph3md1, ph3md0) bits 5 and 4ph2 mode 1 and 0 (ph2md1, ph2md0) bits 3 and 2ph1 mode 1 and 0 (ph1md1, ph1md0) bits 1 and 0ph0 mode 1 and 0 (ph0md1, ph0md0) these bits select the pin functions and the input pullup mos control. bit 13: ph6md1 bit 12: ph6md0 pin function 0 0 other function (see table 18.1) (initial value) ( asemd0 = 0) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) ( asemd0 = 1) 1 1 port input (pullup mos: off)
598 bit (2n + 1): phnmd1 bit 2n: phnmd0 pin function 0 0 other function (see table 18.1) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) (n = 0 to 5) 18.3.9 port j control register (pjcr) port j control register (pjcr) is a 16-bit read/write register that selects the pin functions. pjcr is initialized to h'0000 by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pj7 md1 pj7 md0 pj6 md1 pj6 md0 pj5 md1 pj5 md0 pj4 md1 pj4 md0 pj3 md1 pj3 md0 pj2 md1 pj2 md0 pj1 md1 pj1 md0 pj0 md1 pj0 md0 initial value: 0000000000000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pj7 mode 1 and 0 (pj7md1, pj7md0) bits 13 and 12pj6 mode 1 and 0 (pj6md1, pj6md0) bits 11 and 10pj5 mode 1 and 0 (pj5md1, pj5md0) bits 9 and 8pj4 mode 1 and 0 (pj4md1, pj4md0) bits 7 and 6pj3 mode 1 and 0 (pj3md1, pj3md0) bits 5 and 4pj2 mode 1 and 0 (pj2md1, pj2md0) bits 3 and 2pj1 mode 1 and 0 (pj1md1, pj1md0) bits 1 and 0pj0 mode 1 and 0 (pj0md1, pj0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pjnmd1 bit 2n: pjnmd0 pin function 0 0 other function (see table 18.1) (initial value) 0 1 port output 1 0 port input (pullup mos: on) 1 1 port input (pullup mos: off) (n = 0 to 7)
599 18.3.10 port k control register (pkcr) port k control register (pkcr) is a 16-bit read/write register that selects the pin functions. pkcr is initialized to h'0000 by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pk7 md1 pk7 md0 pk6 md1 pk6 md0 pk5 md1 pk5 md0 pk4 md1 pk4 md0 pk3 md1 pk3 md0 pk2 md1 pk2 md0 pk1 md1 pk1 md0 pk0 md1 pk0 md0 initial value: 0000000000000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pk7 mode 1 and 0 (pk7md1, pk7md0) bits 13 and 12pk6 mode 1 and 0 (pk6md1, pk6md0) bits 11 and 10pk5 mode 1 and 0 (pk5md1, pk5md0) bits 9 and 8pk4 mode 1 and 0 (pk4md1, pk4md0) bits 7 and 6pk3 mode 1 and 0 (pk3md1, pk3md0) bits 5 and 4pk2 mode 1 and 0 (pk2md1, pk2md0) bits 3 and 2pk1 mode 1 and 0 (pk1md1, pk1md0) bits 1 and 0pk0 mode 1 and 0 (pk0md1, pk0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): pknmd1 bit 2n: pknmd0 pin function 0 0 other function (see table 18.1) (initial value) 0 1 port output 1 0 port input (pullup mos: on) 1 1 port input (pullup mos: off) (n = 0 to 7)
600 18.3.11 port l control register (plcr) port l control register (plcr) is a 16-bit read/write register that selects the pin functions. plcr is initialized to h'0000 by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit:1514131211109876543210 pl7 md1 pl7 md0 pl6 md1 pl6 md0 pl5 md1 pl5 md0 pl4 md1 pl4 md0 pl3 md1 pl3 md0 pl2 md1 pl2 md0 pl1 md1 pl1 md0 pl0 md1 pl0 md0 initial value: 0000000000000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14pl7 mode 1 and 0 (pl7md1, pl7md0) bits 13 and 12pl6 mode 1 and 0 (pl6md1, pl6md0) bits 11 and 10pl5 mode 1 and 0 (pl5md1, pl5md0) bits 9 and 8pl4 mode 1 and 0 (pl4md1, pl4md0) bits 7 and 6pl3 mode 1 and 0 (pl3md1, pl3md0) bits 5 and 4pl2 mode 1 and 0 (pl2md1, pl2md0) bits 3 and 2pl1 mode 1 and 0 (pl1md1, pl1md0) bits 1 and 0pl0 mode 1 and 0 (pl0md1, pl0md0) these bits select the pin functions and the input pullup mos control. bit (2n + 1): plnmd1 bit 2n: plnmd0 pin function 0 0 other function (see table 18.1) (initial value) 0 1 reserved (setting prohibited) 1 0 port input 1 1 port input (n = 0 to 7) when the da0 and da1 pins are used as the d/a converter outputs or when ptl7 and ptl6 are used as the other function states, plcr should remain at its initial value.
601 18.3.12 sc port control register (scpcr) sc port control register (scpcr) is a 16-bit read/write register that selects the pin functions. the setting of scpcr is valid only when the transmit/receive operation is disabled in the setting of the scscr register. scpcr is initialized to h'a888 by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. when the te bit in scscr is set to 1, the other function output state has a higher priority than the scpcr setting of the txd[2:0] pin. when the re bit in scscr is set to 1, the input state has a higher priority than the scpcr setting of the rxd[2:0] pin. bit:1514131211109876543210 scp7 md1 scp7 md0 scp6 md1 scp6 md0 scp5 md1 scp5 md0 scp4 md1 scp4 md0 scp3 md1 scp3 md0 scp2 md1 scp2 md0 scp1 md1 scp1 md0 scp0 md1 scp0 md0 initial value: 1010100010001000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bits 15 and 14scp7 mode 1 and 0 (scp7md1, scp7md0): these bits select the pin functions and the input pullup mos control. bit 15: scp7md1 bit 14: scp7md0 pin function 0 0 other function (see table 18.1) 0 1 reserved (setting prohibited) 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) bits 13 and 12scp6 mode 1 and 0 (scp6md1, scp6md0): these bits select the pin functions and the input pullup mos control. bit 13: scp6md1 bit 12: scp6md0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off)
602 bits 11 and 10: scp5 mode 1 and 0 (scp5md1, scp5md0): these bits select the pin functions and the input pullup mos control. bit 11: scp5md1 bit 10: scp5md0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) bits 9 and 8scp4 mode 1 and 0 (scp4md1, scp4md0): these bits select the pin functions and the input pullup mos control. bit 9: scp4md1 bit 8: scp4md0 pin function 0 0 transmit data output 2 (txd2) receive data input 2 (rxd2) (initial value) 0 1 general output (scpt[4] output pin) receive data input 2 (rxd2) 1 0 scpt[4] input pin pullup (input pin) transmit data output 2 (txd2) 1 1 general input (scpt[4] input pin) transmit data output 2 (txd2) note: there is no combination of simultaneous i/o of scpt[4] because one bit (scp4dt) is accessed using two pins of txd2 and rxd2. when the port input is set (bit scpnmd1 is set to 1) and when the te bit in scscr is set to 1, the txd2 pin is in the output state. when the te bit is cleared to 0, the txd2 pin is in the high- impedance state. bits 7 and 6scp3 mode 1and 0 (scp3md1, scp3md0): these bits select the pin functions and the input pullup mos control. bit 7: scp3md1 bit 6: scp3md0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off)
603 bits 5 and 4scp2 mode 1and 0 (scp2md1, scp2md0): these bits select the pin functions and the input pullup mos control. bit 5: scp2md1 bit 4: scp2md0 pin function 0 0 transmit data output 1 (txd1) receive data input 1 (rxd1) (initial value) 0 1 general output (scpt[2] output pin) receive data input 1 (rxd1) 1 0 scpt[2] input pin pullup (input pin) transmit data output 1 (txd1) 1 1 general input (scpt[2] input pin) transmit data output 1 (txd1) note: there is no combination of simultaneous i/o of scpt[2] because one bit (scp2dt) is accessed using two pins of txd1 and rxd1. when the port input is set (bit scpnmd1 is set to 1) and when the te bit in scscr is set to 1, the txd1 pin is in the output state. when the te bit is cleared to 0, the txd1 pin is in the high- impedance state. bits 3 and 2scp1 mode 1and 0 (scp1md1, scp1md0): these bits select the pin functions and the input pullup mos control. bit 3: scp1md1 bit 2: scp1md0 pin function 0 0 other function (see table 18.1) 0 1 port output 1 0 port input (pullup mos: on) (initial value) 1 1 port input (pullup mos: off) bits 1 and 0scp0 mode 1 and 0 (scp0md1, scp0md0): these bits select the pin functions and the input pullup mos control. bit 1: scp0md1 bit 0: scp0md0 pin function 0 0 transmit data output 0 (txd0) receive data input 0 (rxd0) (initial value) 0 1 general output (scpt[0] output pin) receive data input 0 (rxd0) 1 0 scpt[0] input pin pullup (input pin) transmit data output 0 (txd0) 1 1 general input (scpt[0] input pin) transmit data output 0 (txd0) note: there is no combination of simultaneous i/o of scpt[0] because one bit (scp0dt) is accessed using two pins of txd0 and rxd0.
604 when the port input is set (bit scpnmd1 is set to 1) and when the te bit in scscr is set to 1, the txd0 pin is in the output state. when the te bit is cleared to 0, the txd0 pin is in the high- impedance state.
605 section 19 i/o ports 19.1 overview this lsi has twelve 8-bit ports (ports a to l and sc). all port pins are multiplexed with other pin functions (pin function controller (pfc) maintains the selection of the pin functions and pullup mos control). each port has a data register which stores the data to the pins. 19.2 port a port a is an 8-bit i/o port with the pin configuration shown in figure 19.1. each pin has an input pullup mos, which is controlled by port a control register (pacr) in pfc. pta7 (i/o)/d23 (i/o) pta6 (i/o)/d22 (i/o) pta5 (i/o)/d21 (i/o) pta4 (i/o)/d20 (i/o) pta3 (i/o)/d19 (i/o) pta2 (i/o)/d18 (i/o) pta1 (i/o)/d17 (i/o) pta0 (i/o)/d16 (i/o) port a figure 19.1 port a 19.2.1 register descriptions table 19.1 summarizes the register of port a. table 19.1 register descriptions name abbreviation r/w initial value address access size port a data register padr r/w h'0000 h'04000120 (h'a4000120) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
606 19.2.2 port a data register (padr) port a data register (padr) is an 8-bit read/write register that stores data for pins pta7 to pta0. pa7dt to pa0dt bit corresponds to pta7 to pta0 pin. when the pin function is general output port, if the port is read the value of the corresponding padr bit is returned directly. when the function is general input port, if the port is read the corresponding pin level is read. table 19.2 shows the function of padr. padr is initialized to h'0000 by a power-on reset. it retains its previous value in standby mode and sleep mode, and in a manual reset. bit: 7 6 5 4 3 2 1 0 pa7dt pa6dt pa5dt pa4dt pa3dt pa2dt pa1dt pa0dt initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 19.2 read/write operation of the port a data register (padr) panmd1 panmd0 pin state read write 0 0 other function (see table 18.1) padr value value is written to padr, but does not affect pin state. 1 output padr value write value is output from pin. 1 0 input (pullup mos on) pin state value is written to padr, but does not affect pin state. 1 input (pullup mos off) pin state value is written to padr, but does not affect pin state. (n = 7 to 0)
607 19.3 port b port b is an 8-bit i/o port with the pin configuration shown in figure 19.2. each pin has an input pullup mos, which is controlled by port b control register (pbcr) in pfc. ptb7 (i/o)/d31 (i/o) ptb6 (i/o)/d30 (i/o) ptb5 (i/o)/d29 (i/o) ptb4 (i/o)/d28 (i/o) ptb3 (i/o)/d27 (i/o) ptb2 (i/o)/d26 (i/o) ptb1 (i/o)/d25 (i/o) ptb0 (i/o)/d24 (i/o) port b figure 19.2 port b 19.3.1 register descriptions table 19.3 summarizes the register of port b. table 19.3 register descriptions name abbreviation r/w initial value address access size port b data register pbdr r/w h'0000 h'04000122 (h'a4000122) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
608 19.3.2 port b data register (pbdr) port b data register (pbdr) is an 8-bit read/write register that stores data for pins ptb7 to ptb0. pb7dt to pb0dt bit corresponds to ptb7 to ptb0 pin. when the pin function is general output port, if the port is read the value of the corresponding pbdr bit is returned directly. when the function is general input port, if the port is read the corresponding pin level is read. table 19.4 shows the function of pbdr. pbdr is initialized to h'0000 by a power-on reset. it retains its previous value in standby mode and sleep mode, and in a manual reset. bit: 7 6 5 4 3 2 1 0 pb7dt pb6dt pb5dt pb4dt pb3dt pb2dt pb1dt pb0dt initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 19.4 read/write operation of the port b data register (pbdr) pbnmd1 pbnmd0 pin state read write 0 0 other function (see table 18.1) pbdr value value is written to pbdr, but does not affect pin state. 1 output pbdr value write value is output from pin. 1 0 input (pullup mos on) pin state value is written to pbdr, but does not affect pin state. 1 input (pullup mos off) pin state value is written to pbdr, but does not affect pin state. (n = 7 to 0)
609 19.4 port c port c is an 8-bit i/o port with the pin configuration shown in figure 19.3. each pin has an input pullup mos, which is controlled by port c control register (pccr) in pfc. ptc7 (i/o)/pint7 (input)/ msc7 (output) ptc6 (i/o)/pint6 (input)/ msc6 (output) ptc5 (i/o)/pint5 (input)/ msc5 (output) ptc4 (i/o)/pint4 (input)/ msc4 (output) ptc3 (i/o)/pint3 (input)/ msc3 (output) ptc2 (i/o)/pint2 (input)/ msc2 (output) ptc1 (i/o)/pint1 (input)/ msc1 (output) ptc0 (i/o)/pint0 (input)/ msc0 (output) port c figure 19.3 port c 19.4.1 register descriptions table 19.5 summarizes the register of port c. table 19.5 register description name abbreviation r/w initial value address access size port c data register pcdr r/w h'00 h'04000124 (h'a4000124) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
610 19.4.2 port c data register (pcdr) port c data register (pcdr) is an 8-bit read/write register that stores data for pins ptc7 to ptc0. pc7dt to pc0dt bit corresponds to ptc7 to ptc0 pin. when the pin function is general output port, if the port is read, the value of the corresponding pcdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. table 19.6 shows the function of pcdr. pcdr is initialized to h'00 by a power-on reset, after which the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read. bit: 7 6 5 4 3 2 1 0 pc7dt pc6dt pc5dt pc4dt pc3dt pc2dt pc1dt pc0dt initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 19.6 read/write operation of the port c data register (pcdr) pcnmd1 pcnmd0 pin state read write 0 0 other function (see table 18.1) pcdr value value is written to pcdr, but does not affect pin state. 1 output pcdr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to pcdr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to pcdr, but does not affect pin state. (n = 7 to 0)
611 19.5 port d port d is a 6-bit i/o and 2-bit input port with the pin configuration shown in figure 19.3. each pin has an input pullup mos, which is controlled by port d control register (pdcr) in pfc. ptd7 (i/o)/dack1 (output) ptd6 (input)/ dreq1 (input) ptd5 (i/o)/dack0 (output) ptd4 (input)/ dreq0 (input) ptd3 (i/o)/ wakeup (output) ptd2 (i/o)/ resetout (output) ptd1 (i/o)/drak0 (output) ptd0 (i/o)/drak1 (output) port d figure 19.4 port d 19.5.1 register descriptions table 19.7 summarizes the register of port d. table 19.7 register descriptions name abbreviation r/w initial value address access size port d data register pddr r/w or r b'0*0*0000 h'04000126 (h'a4000126) * 1 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * means no value. * 1 when address translation by the mmu does not apply, the address in parentheses should be used.
612 19.5.2 port d data register (pddr) port d data register (pddr) is a 6-bit read/write and 2-bit read register that stores data for pins ptd7 to ptd0. pd7dt to pd0dt bit corresponds to ptd7 to ptd0 pin. when the pin function is general output port, if the port is read, the value of the corresponding pddr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. table 19.8 shows the function of pddr. pddr is initialized to b'0 * 0 * 0000 by a power-on reset. after initialization, the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read from bits pd7dtpd3dt, pd1dt, and pd0dt. it retains its previous value in standby mode and sleep mode, and in a manual reset. note that the low level is read if bits 6 and 4 are read except in general-purpose input. bit: 7 6 5 4 3 2 1 0 pd7dt pd6dt pd5dt pd4dt pd3dt pd2dt pd1dt pd0dt initial value: 0 * 0 * 0 0 0 0 r/w: r/w r r/w r r/w r/w r/w r/w note: * undefined table 19.8 read/write operation of the port d data register (pddr) pdnmd1 pdnmd0 pin state read write 0 0 other function (see tabel 18.1) pddr value value is written to pddr, but does not affect pin state. 1 output pddr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to pddr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to pddr, but does not affect pin state. (n = 0, 1, 2, 3, 5, 7) pdnmd1 pdnmd0 pin state read write 0 0 other function (see table 18.1) low level ignored ( no affect on pin state) 1 reserved low level ignored ( no affect on pin state) 1 0 input (pullup mos: on) pin state ignored ( no affect on pin state) 1 input (pullup mos: off) pin state ignored ( no affect on pin state) (n = 4, 6)
613 19.6 port e port e is an 8-bit i/o port with the pin configuration shown in figure 19.5. each pin has an input pullup mos, which is controlled by port e control register (pecr) in pfc. pte7 (i/o)/ audsync (output) pte6 (i/o)/ cas2l (output) pte5 (i/o)/ ce2b (output) pte4 (i/o)/ ce2a (output) pte3 (i/o)/ cas2h (output) pte2 (i/o)/ ras3u (output) pte1 (i/o)/ ras2u (output) pte0 (i/o)/tdo (output) port e figure 19.5 port e 19.6.1 register descriptions table 19.9 summarizes the register of port e. table 19.9 register descriptions name abbreviation r/w initial value address access size port e data register pedr r/w h'00 h'04000128 (h'a4000128) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
614 19.6.2 port e data register (pedr) port e data register (pedr) is an 8-bit read/write register that stores data for pins pte7 to pte0. pe7dt to pe0dt bit corresponds to pte7 to pte0 pin. when the pin function is general output port, if the port is read the value of the corresponding pedr bit is returned directly. when the function is general input port, if the port is read the corresponding pin level is read. table 19.10 shows the function of pedr. pedr is initialized to h'00 by a power-on reset, after which the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read. it retains its previous value in standby mode and sleep mode, and in a manual reset. bit: 7 6 5 4 3 2 1 0 pe7dt pe6dt pe5dt pe4dt pe3dt pe2dt pe1dt pe0dt initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 19.10 read/write operation of the port e data register (pedr) penmd1 penmd0 pin state read write 0 0 other function (see table 18.1) pedr value value is written to pedr, but does not affect pin state. 1 output pedr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to pedr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to pedr, but does not affect pin state. (n = 0 to 7)
615 19.7 port f port f is an 8-bit input port with the pin configuration shown in figure 19.6. each pin has an input pullup mos, which is controlled by port f control register (pfcr) in pfc. ptf7 (input)/pint15 (input)/ trst (input) ptf6 (input)/pint14 (input)/tms (input) ptf5 (input)/pint13 (input)/tdi (input) ptf4 (input)/pint12 (input)/tck (input) ptf3 (input)/pint11 (input)/ irls3 (input) ptf2 (input)/pint10 (input)/ irsl2 (input) ptf1 (input)/pint9 (input)/ irls1 (input) ptf0 (input)/pint8 (input)/ irls0 (input) port f figure 19.6 port f 19.7.1 register descriptions table 19.11 summarizes the register of port f. table 19.11 register descriptions name abbreviation r/w initial value address access size port f data register pfdr r h'** h'400012a (h'a400012a) * 1 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * means no value. * 1 when address translation by the mmu does not apply, the address in parentheses should be used.
616 19.7.2 port f data register (pfdr) port f data register (pfdr) is an 8-bit read register that stores data for pins ptf7 to ptf0. pf7dt to pf0dt bit corresponds to ptf7 to ptf0 pin. when the function is general input port, if the port is read the corresponding pin level is read. table 19.12 shows the function of pfdr. pfdr is initialized by a power-on reset, after which the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read. bit: 7 6 5 4 3 2 1 0 pf7dt pf6dt pf5dt pf4dt pf3dt pf2dt pf1dt pf0dt initial value: * * * * * * * * r/w: r r r r r r r r note: * undefined table 19.12 read/write operation of the port f data register (pfdr) pfnmd1 pfnmd0 pin state read write 0 0 other function (see table 18.1) h'00 ignored (no affect on pin state) 1 reserved h'00 ignored (no affect on pin state) 1 0 input (pullup mos: on) pin state ignored (no affect on pin state) 1 input (pullup mos: off) pin state ignored (no affect on pin state) (n = 0 to 7)
617 19.8 port g port g is an 8-bit input port with the pin configuration shown in figure 19.7. each pin has an input pullup mos, which is controlled by port g control register (pgcr) in pfc. ptg7 (input)/iois16 (input) ptg6 (input)/ asemd0 (input) ptg5 (input)/ asebrkak (output) ptg4 (input) ptg3 (input)/audata3 (output) ptg2 (input)/audata2 (output) ptg1 (input)/audata1 (output) ptg0 (input)/audata0 (output) port g figure 19.7 port g 19.8.1 register descriptions table 19.13 summarizes the register of port g. table 19.13 register descriptions name abbreviation r/w initial value address access size port g data register pgdr r/w h'** h'0400012c (h'a400012c) * 1 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * means no value. * 1 when address translation by the mmu does not apply, the address in parentheses should be used.
618 19.8.2 port g data register (pgdr) port g data register (pgdr) is an 8-bit read register that stores data for pins ptg7 to ptg0. pg7dt to pg0dt bit corresponds to ptg7 to ptg0 pin. when the function is general input port, if the port is read the corresponding pin level is read. table 19.14 shows the function of pgdr. pgdr is initialized by a power-on reset, after which the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read. bit: 7 6 5 4 3 2 1 0 pg7dt pg6dt pg5dt pg4dt pg3dt pg2dt pg1dt pg0dt initial value: * * * * * * * * r/w: r r r r r r r r note: * undefined table 19.14 read/write operation of the port g data register (pgdr) pgnmd1 pgnmd0 pin state read write 0 0 other function (see table 18.1) h'00 ignored (no affect on pin state) 1 reserved h'00 ignored (no affect on pin state) 1 0 input (pullup mos: on) pin state ignored (no affect on pin state) 1 input (pullup mos: off) pin state ignored (no affect on pin state) (n = 0 to 7)
619 19.9 port h port h is a 1-bit i/o and 5-bit input port with the pin configuration shown in figure 19.8. each pin has an input pullup mos, which is controlled by port h control register (phcr) in pfc. pth7 (i/o)/tclk (output) pth4 (input)/irq4 (input) pth3 (input)/irq3 (input) pth2 (input)/irq2 (input) pth6 (input)/audck (input) pth5 (input)/adtrg (input) pth1 (input)/irq1 (input) pth0 (input)/irq0 (input) port h figure 19.8 port h 19.9.1 register descriptions table 19.15 summarizes the register of port h. table 19.15 register descriptions name abbreviation r/w initial value address access size port h data register phdr r/w or r b'0******* h'0400012e (h'a400012e) * 1 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * means no value. * 1 when address translation by the mmu does not apply, the address in parentheses should be used.
620 19.9.2 port h data register (phdr) port h data register (phdr) is a 1-bit read/write and 7-bit read register that stores data for pins pth7 to pth0. ph7dt to ph0dt bit corresponds to pth7 to pth0 pin. when the pin function is general output port, if the port is read, the value of the corresponding phdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. table 19.16 shows the function of phdr. phdr is initialized to h'00 by a power-on reset, after which the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read. it retains its previous value in standby mode and sleep mode, and in a manual reset. note that the low level is read if bits 6 to 0 are read except in general-purpose input. bit: 7 6 5 4 3 2 1 0 ph7dt ph6dt ph5dt ph4dt ph3dt ph2dt ph1dt ph0dt initial value: 0 * * * * * * * r/w: r/w r r r r r r r note: * undefined table 19.16 read/write operation of the port h data register (phdr) phnmd1 phnmd0 pin state read write 0 0 other function (see table 18.1) phdr value value is written to phdr, but does not affect pin state. 1 output phdr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to phdr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to phdr, but does not affect pin state. (n = 7) phnmd1 phnmd0 pin state read write 0 0 other function (see table 18.1) low level ignored (no affect on pin state) 1 reserved low level ignored (no affect on pin state) 1 0 input (pullup mos: on) pin state ignored (no affect on pin state) 1 input (pullup mos: off) pin state ignored (no affect on pin state) (n = 0 to 6)
621 19.10 port j port j is an 8-bit i/o port with the pin configuration shown in figure 19.9. each pin has an input pullup mos, which is controlled by port j control register (pjcr) in pfc. ptj7 (i/o)/status1 (output) ptj6 (i/o)/status0 (output) ptj5 (i/o)/cashh (output) ptj4 (i/o)/cashl (output) ptj3 (i/o)/caslh (output)/casu (output) ptj2 (i/o)/casll (output)/casl (output) ptj1 (i/o)/ras2l (output) ptj0 (i/o)/ras3l (output) port j figure 19.9 port j 19.10.1 register descriptions table 19.17 summarizes the register of port j. table 19.17 register descriptions name abbreviation r/w initial value address access size port j data register pjdr r/w h'00 h'04000130 (h'a4000130) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used. 19.10.2 port j data register (pjdr) port j data register (pjdr) is an 8-bit read/write register that stores data for pins ptj7 to ptj0. pj7dt to pj0dt bit corresponds to ptj7 to ptj0 pin. when the pin function is general output port, if the port is read the value of the corresponding pjdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. table 19.18 shows the function of pjdr.
622 pjdr is initialized to h'00 by a power-on reset. it retains its previous value in software standby mode and sleep mode, and in a manual reset. bit: 7 6 5 4 3 2 1 0 pj7dt pj6dt pj5dt pj4dt pj3dt pj2dt pj1dt pj0dt initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 19.18 read/write operation of the port j data register (pjdr) pjnmd1 pjnmd0 pin state read write 0 0 other function (see table 18.1) pjdr value value is written to pjdr, but does not affect pin state. 1 output pjdr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to pjdr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to pjdr, but does not affect pin state. (n = 0 to 7)
623 19.11 port k port k is an 8-bit i/o port with the pin configuration shown in figure 19.10. each pin has an input pullup mos, which is controlled by port k control register (pkcr) in pfc. ptk7 (i/o)/ we3 (output)/dqmuu (output)/ iciowr (output) ptk6 (i/o)/ we2 (output)/dqmul (output)/ iciord (output) ptk5 (i/o)/cke (output) ptk4 (i/o)/ bs (output) ptk3 (i/o)/ cs5 (output)/ ce1a (output) ptk2 (i/o)/ cs4 (output) ptk1 (i/o)/ cs3 (output) ptk0 (i/o)/ cs2 (output) port k figure 19.10 port k 19.11.1 register descriptions table 19.19 summarizes the register of port k. table 19.19 register descriptions name abbreviation r/w initial value address access size port k data register pkdr r/w h'00 h'04000132 (h'a4000132) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
624 19.11.2 port k data register (pkdr) port k data register (pkdr) is an 8-bit read/write register that stores data for pins ptk7 to ptk0. pk7dt to pk0dt bit corresponds to ptk7 to ptk0 pin. when the pin function is general output port, if the port is read, the value of the corresponding pkdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. table 19.20 shows the function of pkdr. pkdr is initialized to h'00 by a power-on reset. it retains its previous value in standby mode and sleep mode, and in a manual reset. bit: 7 6 5 4 3 2 1 0 pk7dt pk6dt pk5dt pk4dt pk3dt pk2dt pk1dt pk0dt initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 19.20 read/write operation of the port k data register (pkdr) pknmd1 pknmd0 pin state read write 0 0 other function (see table 18.1) pkdr value value is written to pkdr, but does not affect pin state. 1 output pkdr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to pkdr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to pkdr, but does not affect pin state. (n = 0 to 7)
625 19.12 port l port l is an 8-bit input port with the pin configuration shown in figure 19.11. ptl7 (input)/an7 (input)/da0 (input) ptl6 (input)/an6 (input)/da1 (input) ptl5 (input)/an5 (input) ptl4 (input)/an4 (input) ptl3 (input)/an3 (input) ptl2 (input)/an2 (input) ptl1 (input)/an1 (input) ptl0 (input)/an0 (input) port l figure 19.11 port l 19.12.1 register descriptions table 19.21 summarizes the register of port l. table 19.21 register descriptions name abbreviation r/w initial value address access size port l data register pldr r h'00 h'04000134 (h'a4000134) * 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * when address translation by the mmu does not apply, the address in parentheses should be used.
626 19.12.2 port l data register (pldr) port l data register (pldr) is an 8-bit read register that stores data for pins ptl7 to ptl0. pl7dt to pl0dt bit corresponds to ptl7 to ptl0 pin. when the function is general input port, if the port is read, the corresponding pin level is read. table 19.22 shows the function of pldr. port l is multiplexed with analog pins, and does not include pull-up moss. pkdr is initialized to h'00 by power-on reset. it retains its previous value in software standby mode, sleep mode and by manual reset. bit: 7 6 5 4 3 2 1 0 pl7dt pl6dt pl5dt pl4dt pl3dt pl2dt pl1dt pl0dt initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r table 19.22 read/write operation of the port l data register (pldr) plnmd1 plnmd0 pin state read write 0 0 other function (see table 18.1) h'00 ignored (no affect on pin state) 1 reserved h'00 ignored (no affect on pin state) 1 0 input pin state ignored (no affect on pin state) 1 input pin state ignored (no affect on pin state) (n = 0 to 7)
627 19.13 sc port sc port is a 4-bit i/o, 3-bit output and 4-bit input port with the pin configuration shown in figure 19.12. each pin has an input pullup mos, which is controlled by sc port control register (scpcr) in pfc. scpt7 (input)/ cts2 (input)/irq5 (input) scpt6 (i/o)/ rts2 (output) scpt5 (i/o)/sck2 (i/o) scpt4 (input)/rxd2 (input) scpt4 (output)/txd2 (output) scpt3 (i/o)/sck1 (i/o) scpt2 (input)/rxd1 (input) scpt2 (output)/txd1 (output) scpt1 (i/o)/sck0 (i/o) scpt0 (input)/rxd0 (input) scpt0 (output)/txd0 (output) sc port figure 19.12 sc port 19.13.1 register descriptions table 19.23 summarizes the register of sc port. table 19.23 register descriptions name abbreviation r/w initial value address access size sc port data register scpdr r/w or r b'*0000000 h'04000136 (h'a4000136) * 1 8 notes: this register is located in area 1 of the physical space. when the cache is enabled, either access this register from the p2 area in the virtual space, or make appropriate settings by the mmu so that this register is not cached. * means no value. * 1 when address translation by the mmu does not apply, the address in parentheses should be used. 19.13.2 port sc data register (scpdr) port sc data register (scpdr) is a 7-bit read/write and 1-bit read register that stores data for pins scpt7 to scpt0. scp7dt to scp0dt bit corresponds to scpt7 to scpt0 pin. when the pin function is general output port, if the port is read, the value of the corresponding scpdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin
628 level is read. table 19.24 shows the function of scpdr. scpdr is initialized to b'*0000000 by a power-on reset. after initialization, the general input port function (pullup mos on) is set as the initial pin function, and the corresponding pin levels are read from bits scp7dtscp5dt, scp3dt, and scp1dt. scpdr retains its previous value in standby mode and sleep mode, and in a manual reset. note that the low level is read if bit 7 is read except in general-purpose input. bit: 7 6 5 4 3 2 1 0 scp7dt scp6dt scp5dt scp4dt scp3dt scp2dt scp1dt scp0dt initial value: * 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w note: * undefined table 19.24 read/write operation of the sc port data register (scpdr) scpnmd1 scpnmd0 pin state read write 0 0 other function (see table 18.1) scpdr value value is written to scpdr, but does not affect pin state. 1 output scpdr value write value is output from pin. 1 0 input (pullup mos: on) pin state value is written to scpdr, but does not affect pin state. 1 input (pullup mos: off) pin state value is written to scpdr, but does not affect pin state. (n = 0 to 6) scpnmd1 scpnmd0 pin state read write 0 0 other function (see table 18.1) low level ignored (no affect on pin state) 1 output low level ignored (no affect on pin state) 1 0 input (pullup mos: on) pin state ignored (no affect on pin state) 1 input (pullup mos: off) pin state ignored (no affect on pin state) (n = 7)
629 section 20 a/d converter 20.1 overview this lsi includes a 10-bit successive-approximation a/d converter with a selection of up to eight analog input channels. 20.1.1 features a/d converter features are listed below. ? 10-bit resolution ? eight input channels ? high-speed conversion ? conversion time: maximum 8.86 s per channel (with p? = 15-mhz peripheral clock) ? three conversion modes ? single mode: a/d conversion of one channel ? multi mode: a/d conversion on one to four channels ? scan mode: continuous a/d conversion on one to four channels ? four 16-bit data registers ? a/d conversion results are transferred for storage into data registers corresponding to the channels. ? sample-and-hold function ? a/d conversion can be externally triggered ? a/d interrupt requested at the end of conversion ? at the end of a/d conversion, an a/d end interrupt (adi) can be requested.
630 20.1.2 block diagram figure 20.1 shows a block diagram of the a/d converter. 10-bit d/a addra addrb addrd bus interface peripheral data bus analog multi- plexer control circuit successive approxi- mation register + C comparator sample-and- hold circuit adi interrupt signal av ss an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 /4 /8 adcsr adcr av cc a/d converter legend: adcr: a/d control register adcsr: a/d control/status register addra: a/d data register a addrb: a/d data register b addrc: a/d data register c addrd: a/d data register d internal data bus adtrg addrc figure 20.1 a/d converter block diagram
631 20.1.3 input pins table 20.1 summarizes the a/d converters input pins. the eight analog input pins are divided into two groups: group 0 (an 0 to an 3 ), and group 1 (an 4 to an 7 ). av cc and av ss are the power supply for the analog circuits in the a/d converter. avcc also functions as the a/d converter reference voltage. table 20.1 a/d converter pins pin name abbreviation i/o function analog power-supply pin avcc input analog power supply analog ground pin avss input analog ground and reference voltage analog input pin 0 an0 input group 0 analog inputs analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input analog input pin 4 an4 input group1 analog inputs analog input pin 5 an5 input analog input pin 6 an6 input analog input pin 7 an7 input a/d external trigger input pin adtrg input external trigger input for starting a/d conversion
632 20.1.4 register configuration table 20.2 summarizes the a/d converters registers. table 20.2 a/d converter registers name abbreviation r/w initial value address access size a/d data register a (high) addrah r h'00 h'04000080 (h'a4000080) * 2 8, 16, 32 * 3, * 4 a/d data register a (low) addral r h'00 h'04000082 (h'a4000082) * 2 8, 16 * 3 a/d data register b (high) addrbh r h'00 h'04000084 (h'a4000084) * 2 8, 16, 32 * 3, * 4 a/d data register b (low) addrbl r h'00 h'04000086 (h'a4000086) * 2 8, 16 * 3 a/d data register c (high) addrch r h'00 h'04000088 (h'a4000088) * 2 8, 16, 32 * 3, * 4 a/d data register c (low) addrcl r h'00 h'0400008a (h'a400008a) * 2 8, 16 * 3 a/d data register d (high) addrdh r h'00 h'0400008c (h'a400008c) * 2 8, 16, 32 * 3, * 4 a/d data register d (low) addrdl r h'00 h'0400008e (h'a400008e) * 2 8, 16 * 3 a/d control/status register adcsr r/(w) * 1 h'00 h'04000090 (h'a4000090) * 2 8, 16, 32 * 3, * 4 a/d control register adcr r/w h'3f h'04000092 (h'a4000092) * 2 8, 16 * 3 notes: these registers are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 only 0 can be written in bit 7, to clear the flag. * 2 when address translation by the mmu does not apply, the address in parentheses should be used. * 3 in 16-bit access, it is not possible to read data in two registers simultaneously. * 4 in 32-bit access, it is possible to read data in the register at the accessed address + 2 simultaneously.
633 20.2 register descriptions 20.2.1 a/d data registers a to d (addra to addrd) the four a/d data registers (addra to addrd) are 16-bit read-only registers that store the results of a/d conversion. an a/d conversion produces 10-bit data, which is transferred for storage into the a/d data register corresponding to the selected channel. the upper 8 bits of the result are stored in the upper byte (bits 15 to 8) of the a/d data register. the lower 2 bits are stored in the lower byte (bits 7 and 6). bits 5 to 0 of an a/d data register are reserved bits that always read 0. table 20.3 indicates the pairings of analog input channels and a/d data registers. the a/d data registers are initialized to h'0000 by a reset and in standby mode. bit: 15 14 13 12 11 10 9 8 addrn: ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 addrn: ad1 ad0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r n = a to d table 20.3 analog input channels and a/d data registers analog input channel group 0 group 1 a/d data register an0 an4 addra an1 an5 addrb an2 an6 addrc an3 an7 addrd
634 20.2.2 a/d control/status register (adcsr) adcsr is an 8-bit read/write register that selects the mode and controls the a/d converter. adcsr is initialized to h'00 by a reset and in standby mode. bit: 7 6 5 4 3 2 1 0 adf adie adst multi cks ch2 ch1 ch0 initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/w r/w r/w r/w r/w r/w r/w note: * write 0 to clear the flag. bit 7a/d end flag (adf): indicates the end of a/d conversion. bit 7: adf description 0 [clear condition] (initial value) (1) cleared by reading adf while adf = 1, then writing 0 in adf (2) cleared when dmac is activated by adi interrupt and addr is read 1 [set conditions] single mode: a/d conversion ends multi mode: a/d conversion ends in all selected channels bit 6a/d interrupt enable (adie): enables or disables the interrupt (adi) requested at the end of a/d conversion. bit 6: adie description 0 a/d end interrupt request (adi) is disabled (initial value) 1 a/d end interrupt request (adi) is enabled bit 5a/d start (adst): starts or stops a/d conversion. the adst bit remains set to 1 during a/d conversion. it can also be set to 1 by external trigger input at the adtrg pin. bit 5: adst description 0 a/d conversion is stopped (initial value) 1 single mode: a/d conversion starts; adst is automatically cleared to 0 when conversion ends. scan mode: a/d conversion starts and continues, cycling among the selected channels, until adst is cleared to 0 by software, by a reset, or by a transition to standby mode.
635 bit 4multi mode (multi): selects single mode or multi mode or scan mode. for further information on operation in these modes, see section 20.5, operation. bit 4:multi adcr: bit5:scn description 0 single mode (initial value) 1 0 multi mode 1 scan mode bit 3clock select (cks): selects the a/d conversion time. clear the adst bit to 0 before switching the conversion time. bit 3:cks description 0 conversion time = 266 states (maximum) (initial value) 1 conversion time = 134 states (maximum) bits 2 to 0channel select 2 to 0 (ch2 to ch0): these bits and the multi bit select the analog input channels. clear the adst bit to 0 before changing the channel selection. channel selection description ch2 ch1 ch0 single mode (multi = 0) multi mode (multi = 1) 0 0 0 an0 (initial value) an0 1 an1 an0, an1 1 0 an2 an0 to an2 1 an3 an0 to an3 1 0 0 an4 an4 1 an5 an4, an5 1 0 an6 an4 to an6 1 an7 an4 to an7
636 20.2.3 a/d control register (adcr) adcr is an 8-bit read/write register that enables or disables external triggering of a/d conversion. adcr is initialized to h'07 by a reset and in standby mode. bit: 76543210 trge1 trge0 scn resvd1 resvd2 initial value: 00000111 r/w: r/w r/w r/w r/w r/w r r r bits 7 and 6trigger enable (trge1, trge0): enables or disables external triggering of a/d conversion. the trge1 and trge0 bits should only be set when conversion is not in progress. bit 7: trge1 bit 6: trge0 description 0 0 when an external trigger is input, the a/d conversion does not 01 start (initial value) 10 1 1 the a/d conversion starts at the falling edge of an input signal from the external trigger pin ( adtrg ). bit 5scan mode (scn): selects multi mode or scan mode when the multi bit is set to 1. see the description of bit 4 in section 20.2.2. bits 4 and 3reserved (resvd1, resvd2): these bits are always read as 0. the write value should always be 0. bits 2 to 0reserved: these bits are always read as 0. the write value should always be 0.
637 20.3 a/d data register access size 20.3.1 word access when a/d data registers (addraaddrd) are read by word access, the a/d data register value is read in bits 15 to 8, and invalid data in bits 7 to 0. figure 20.2 shows an example in which addrah (h'04000080) is read. 15 7 80 addrah invalid data figure 20.2 example of word access 20.3.2 longword access when a/d data registers (addraaddrd) are read by longword access, the upper byte of the a/d data register is read in bits 31 to 24, invalid data in bits 23 to 16, the lower byte of the a/d data register in bits 15 to 8, and invalid data in bits 7 to 0. figure 20.3 shows an example in which addrah (h'04000080) is read. 15 7 31 23 8 24 0 addrah addral invalid data invalid data 16 figure 20.3 example of longword access
638 20.4 bus master interface addra to addrd are 16-bit registers, but they are connected to the bus master by the upper 8 bits of the 16-bit peripheral data bus. therefore, although the upper byte can be accessed directly by the bus master, the lower byte is read through an 8-bit temporary register (temp). an a/d data register is read as follows. when the upper byte is read, the upper-byte value is transferred directly to the bus master and the lower-byte value is transferred into temp. next, when the lower byte is read, the temp contents are transferred to the bus master. when reading an a/d data register, always read the upper byte before the lower byte. it is possible to read only the upper byte, but if only the lower byte is read, the read value is not guaranteed. figure 20.4 shows the data flow for access to an a/d data register. see section 20.8.3, access size and read data. bus interface temp [h'40] addrn l [h'40] addrn h [h'aa] n = a to d cpu receives data h'aa upper byte read module internal data bus bus interface temp [h'40] addrn l [h'40] addrn h [h'aa] n = a to d cpu receives data h'40 lower byte read module internal data bus figure 20.4 a/d data register access operation (reading h'aa40)
639 20.5 operation the a/d converter operates by successive approximations with 10-bit resolution. it has two operating modes: single mode and scan mode. 20.5.1 single mode (multi = 0) single mode should be selected when only one a/d conversion on one channel is required. a/d conversion starts when the adst bit is set to 1 by software, or by external trigger input. the adst bit remains set to 1 during a/d conversion and is automatically cleared to 0 when conversion ends. when conversion ends the adf bit is set to 1. if the adie bit is also set to 1, an adi interrupt is requested at this time. to clear the adf flag to 0, first read adcsr, then write 0 in adf. when the mode or analog input channel must be switched during a/d conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1 to start a/d conversion again. the adst bit can be set at the same time as the mode or channel is changed. typical operations when channel 1 (an1) is selected in single mode are described next. figure 20.5 shows a timing diagram for this example. 1. single mode is selected (multi = 0), input channel an1 is selected (ch2 = ch1 = 0, ch0 = 1), the a/d interrupt is enabled (adie = 1), and a/d conversion is started (adst = 1). 2. when a/d conversion is completed, the result is transferred into addrb. at the same time the adf flag is set to 1, the adst bit is cleared to 0, and the a/d converter becomes idle. 3. since adf = 1 and adie = 1, an adi interrupt is requested. 4. the a/d interrupt processing routine starts. 5. the routine reads adcsr, then writes 0 in the adf flag. 6. the routine reads and processes the conversion result (addrb = 0). 7. execution of the a/d interrupt processing routine ends. then, when the adst bit is set to 1, a/d conversion starts to execute 2 to 7 above.
640 channel 0 (an0) operating adie adst adf channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra addrb addrc addrd waiting waiting waiting waiting waiting waiting a/d conversion starts set set set clear * clear a/d conversion result 1 a/d conversion result 2 read result read result a/d conversion 1 a/d conversion result 2 note: * downward arrows ( ) indicate instruction execution. figure 20.5 example of a/d converter operation (single mode, channel 1 selected)
641 20.5.2 multi mode (multi = 1) multi mode should be selected when performing multi channel a/d conversions on one or more channels. when the adst bit is set to 1 by software or external trigger input, a/d conversion starts on the first channel in the group (an0 when ch2 = 0, an4 when ch2 = 1). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1 or an5) starts immediately. when a/d conversions end on the selected channels, the adst bit is cleared to 0. the conversion results are transferred for storage into the a/d data registers corresponding to the channels. when the mode or analog input channel selection must be changed during a/d conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conversion will start again from the first channel in the group. the adst bit can be set at the same time as the mode or channel selection is changed. typical operations when three channels in group 0 (an0 to an2) are selected in scan mode are described next. figure 20.6 shows a timing diagram for this example. 1. multi mode is selected (multi = 1), channel group 0 is selected (ch2 = 0), analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an0) is completed, the result is transferred into addra. next, conversion of the second channel (an1) starts automatically. 3. conversion proceeds in the same way through the third channel (an2). 4. when conversion of all selected channels (an0 to an2) is completed, the adf flag is set to 1 and adst bit is cleared to 0. if the adie bit is set to 1, an adi interrupt is requested at this time. when the adst bit is cleared to 0, a/d conversion stops. after that, if the adst bit is set to 1, a/d conversion starts again from the first channel (an0).
642 channel 0 (an0) operating adst adf channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra addrb addrc addrd waiting waiting waiting waiting set clear clear a/d conversion result 2 waiting waiting a/d conversion result 3 a/d conversion 1 waiting a/d conversion result 1 transfer a/d conversion 3 a/d conversion a/d conversion 2 note: downward arrows ( ) indicate instruction executed by software. figure 20.6 example of a/d converter operation (multi mode, channels an0 to an2 selected)
643 20.5.3 scan mode (multi = 1, scn = 1) scan mode is useful for monitoring analog inputs in a group of one or more channels. when the adst bit in the a/d control/status register (adcsr) is set to 1 by software or external trigger input, a/d conversion starts on the first channel in the group (an0 when ch2 = 0, an4 when ch2 = 1)). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1 or an5) starts immediately. a/d conversion continues cyclically on the selected channels until the adst bit is cleared to 0. the conversion results are transferred for storage into the a/d data registers corresponding to the channels. when the mode or analog input channel must be changed during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conversion will start again from the first channel in the group. the adst bit can be set at the same time as the mode or channel selection is changed. typical operations when three channels (an0 to an2) are selected in scan mode are described next. figure 20.7 shows a timing diagram for this example. 1. scan mode is selected (multi = 1, scn = 1), channel group 2 is selected (ch2 = 0), analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an0) is completed, the result is transferred into addra. next, conversion of the second channel (an1) starts automatically. 3. conversion proceeds in the same way through the third channel (an2). 4. when conversion of all the selected channels (an0 to an2) is completed, the adf flag is set to 1 and conversion of the first channel (an0) starts again. if the adie bit is set to 1, an adi interrupt is requested at this time. 5. steps 2 to 4 are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops. after that, if the adst bit is set to 1, a/d conversion starts again from the first channel (an0).
644 adst adf channel 0 (an 0 ) operating channel 1 (an 1 ) operating channel 2 (an 2 ) operating channel 3 (an 3 ) operating addra addrb addrc addrd waiting waiting waiting waiting waiting waiting waiting waiting waiting transfer a/d conversion 1 a/d conversion 4 a/d conversion 2 a/d conversion 3 a/d conversion result 1 a/d conversion result 4 a/d conversion result 2 a/d conversion result 3 clear * clear * set * continuous a/d conversion a/d conversion 5 notes: * downward arrow indicates instruction executed by software. figure 20.7 example of a/d converter operation (scan mode, channels an0 to an2 selected)
645 20.5.4 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog input at a time t d after the adst bit is set to 1, then starts conversion. figure 20.8 shows the a/d conversion timing. table 20.4 indicates the a/d conversion time. as indicated in figure 20.8, the a/d conversion time includes t d and the input sampling time. the length of t d varies depending on the timing of the write access to adcsr. the total conversion time therefore varies within the ranges indicated in table 20.4. in multi mode and scan mode, the values given in table 20.4 apply to the first conversion. in the second and subsequent conversions the conversion time is fixed at 256 states when cks = 0 or 128 states when cks = 1. p? write signal adf * 1 input sampling timing t d a/d conversion start delay t spl input sampling time t conv a/d conversion time notes: * 1 adcsr write cycle * 2 adcsr address address * 2 t d t spl t conv figure 20.8 a/d conversion timing
646 table 20.4 a/d conversion time (single mode) cks = 0 cks = 1 symbol min typ max min typ max a/d conversion start delay t d 10 17 6 9 input sampling time t spl 6532 a/d conversion time t conv 259 266 131 134 note: values in the table are numbers of states (t cyc ). 20.5.5 external trigger input timing a/d conversion can be externally triggered. when the trge1, trge0 bits are set to 1 in adcr, external trigger input is enabled at the adtrg pin. a high-to-low transition at the adtrg pin sets the adst bit to 1 in adcsr, starting a/d conversion. other operations, regardless of the conversion mode, are the same as if the adst bit had been set to 1 by software. figure 20.9 shows the timing. a/d conversion p? adtrg external trigger signal adst figure 20.9 external trigger input timing 20.6 interrupts the a/d converter generates an interrupt (adi) at the end of a/d conversion. the adi interrupt request can be enabled or disabled by the adie bit in adcsr.
647 20.7 definitions of a/d conversion accuracy the a/d converter compares an analog value input from an analog input channel to its analog reference value and converts it into 10-bit digital data. the absolute accuracy of this a/d conversion is the deviation between the input analog value and the output digital value. it includes the following errors: ? offset error ? full-scale error ? quantization error ? nonlinearity error these four error quantities are explained below using figure 20.10. in the figure, the 10 bits of the a/d converter have been simplified to 3 bits. offset error is the deviation between actual and ideal a/d conversion characteristics when the digital output value changes from the minimum (zero voltage) 0000000000 (000 in the figure) to 000000001 (001 in the figure) (figure 20.10, item (1)). full-scale error is the deviation between actual and ideal a/d conversion characteristics when the digital output value changes from the 1111111110 (110 in the figure) to the maximum 1111111111 (111 in the figure) (figure 20.10, item (2)). quantization error is the intrinsic error of the a/d converter and is expressed as 1/2 lsb (figure 20.10, item (3)). nonlinearity error is the deviation between actual and ideal a/d conversion characteristics between zero voltage and full-scale voltage (figure 20.10, item (4)). note that it does not include offset, full-scale or quantization error.
648 111 110 101 100 011 010 001 000 0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 fs analog input voltage fs: full-scale voltage (3) quantization error ideal a/d conversion characteristics (4) nonlinearity error ideal a/d conversion characteristics actual a/d convertion characteristics (2) full-scale error digital output analog input voltage (1) offset error fs digital output figure 20.10 definitions of a/d conversion accuracy 20.8 a/d converter usage notes when using the a/d converter, note the points listed in section 20.8.1 below. 20.8.1 setting analog input voltage ? analog input voltage range: during a/d conversion, the voltages input to the analog input pins ann should be in the range av ss ann av cc (n = 0C7). ? relationships of av cc and av ss to v cc and v ss : av cc , av ss , v cc and v ss should be related as follows: av cc = v cc 0.3 v and av ss = v ss . 20.8.2 processing of analog input pins to prevent damage from voltage surges at the analog input pins (an0Can7), connect an input protection circuit like the one shown in figure 20.10. the circuit shown also includes an rc filter to suppress noise. this circuit is shown as an example; the circuit constants should be selected according to actual application conditions. table 20.5 lists the analog input pin specifications and figure 20.11 shows an equivalent circuit diagram of the analog input ports. 20.8.3 access size and read data table 20.6 shows the relationship between access size and read data. note the read data obtained with different access sizes, bus widths, and endian modes.
649 the case is shown here in which h'3ff is obtained when av cc is input as an analog input. ff is the data containing the upper 8 bits of the conversion result, and c0 is the data containing the lower 2 bits. 0.01 f 10 f av cc an0Can7 av ss superh microprocessor * 100 ? 0.1 f note: * figure 20.11 example of analog input protection circuit 1.0 k ? an0Can7 20 pf 1 m ? figure 20.12 analog input pin equivalent circuit table 20.5 analog input pin ratings item min max unit analog input capacitance 20 pf allowable signal-source impedance 5 k ?
650 table 20.6 relationship between access size and read data access bus width 32 bits (d31d0) 16 bits (d15d0) 8 bits (d7d0) size command endian big little big little big little byte access mov.l mov.b mov.l mov.b #addrah,r9 @r9,r8 #addral,r9 @r9,r8 ffffffff c0c0c0c0 ffffffff c0c0c0c0 ffff c0c0 ffff c0c0 ff c0 ff c0 word access mov.l mov.w mov.l mov.w #addrah,r9 @r9,r8 #addral,r9 @r9,r8 ffxxffxx c0xxc0xx ffxxffxx c0xxc0xx ffxx c0xx ffxx c0xx ffxx c0xx xxff xxc0 longword access mov.l mov.l #addrah,r9 @r9,r8 ffxxc0xx ffxxc0xx ffxxc0xx c0xxffxx ffxxc0xx xxc0xxff in this table: #addrah .equ h'04000080 #addral .equ h'04000082 values are shown in hexadecimal for the case where read data is output to an external device via r8.
651 section 21 d/a converter 21.1 overview this lsi includes a d/a converter with two channels. 21.1.1 features d/a converter features are listed below. ? eight-bit resolution ? two output channels ? conversion time: maximum 10 s (with 20-pf capacitive load) ? output voltage: 0 v to avcc 21.1.2 block diagram figure 21.1 shows a block diagram of the d/a converter. av cc da 0 da 1 dacr dadr0 dadr1 module data bus bus interface on-chip data bus control circuit 8-bit d/a av ss legend: dacr: dadr0: dadr1: d/a control register d/a data register 0 d/a data register 1 figure 21.1 d/a converter block diagram
652 21.1.3 i/o pins table 21.1 summarizes the d/a converters input and output pins. table 21.1 d/a converter pins pin name abbreviation i/o function analog power-supply pin avcc input analog power supply analog ground pin avss input analog ground and reference voltage analog output pin 0 da0 output analog output, channel 0 analog output pin 1 da1 output analog output, channel 1 21.1.4 register configuration table 21.2 summarizes the d/a converters registers. table 21.2 d/a converter registers name abbreviation r/w initial value address * 1 d/a data register 0 dadr0 r/w h'00 h'040000a0 (h'a40000a0) * 2 d/a data register 1 dadr1 r/w h'00 h'040000a2 (h'a40000a2) * 2 d/a control register dacr r/w h'1f h'040000a4 (h'a40000a4) * 2 notes: these registers are located in area 1 of the physical space. when the cache is enabled, either access these registers from the p2 area in the virtual space, or make appropriate settings by the mmu so that these registers are not cached. * 1 lower 16 bits of the address * 2 when address translation by the mmu does not apply, the address in parentheses should be used.
653 21.2 register descriptions 21.2.1 d/a data registers 0 and 1 (dadr0/1) the d/a data registers (dadr0 and dadr1) are 8-bit read/write registers that store the data to be converted. when analog output is enabled, the d/a data register values are constantly converted and output at the analog output pins. the d/a data registers are initialized to h'00 by a reset. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 21.2.2 d/a control register (dacr) dacr is an 8-bit read/write register that controls the operation of the d/a converter. dacr is initialized to h'1f by a reset. bit: 7 6 5 4 3 2 1 0 daoe1 daoe0 dae initial value: 0 0 0 1 1 1 1 1 r/w: r/w r/w r/w r r r r r bit 7d/a output enable 1 (daoe1): controls d/a conversion and analog output. bit 7: daoe1 description 0 da1 analog output is disabled (initial value) 1 channel-1 d/a conversion and da1 analog output are enabled bit 6d/a output enable 0 (daoe0): controls d/a conversion and analog output. bit 6: daoe0 description 0 da0 analog output is disabled (initial value) 1 channel-0 d/a conversion and da0 analog output are enabled
654 bit 5d/a enable (dae): controls d/a conversion, together with bits daoe0 and daoe1. when the dae bit is cleared to 0, d/a conversion is controlled independently in channels 0 and 1. when this lsi enters standby mode while d/a conversion is enabled, the d/a output is held and the analog power-supply current is equivalent to that during d/a conversion. to reduce the analog power-supply current in standby mode, clear the daoe0 and daoe1 bits and disable the d/a output. bit 7: daoe1 bit 6: daoe0 bit 5: dae description 0 0 d/a conversion is disabled in channels 0 and 1 (initial value) 0 1 0 d/a conversion is enabled in channel 0 d/a conversion is disabled in channel 1 0 1 1 d/a conversion is enabled in channels 0 and 1 1 0 0 d/a conversion is disabled in channel 0 d/a conversion is enabled in channel 1 1 0 1 d/a conversion is enabled in channels 0 and 1 1 1 d/a conversion is enabled in channels 0 and 1 when the dae bit is set to 1, even if bits daoe0 and daoe1 in dacr and the adst bit in adcsr are cleared to 0, the same current is drawn from the analog power supply as during a/d and d/a conversion. bits 4 to 0reserved: read-only bits, always read as 1.
655 21.3 operation the d/a converter has two built-in d/a conversion circuits that can perform conversion independently. d/a conversion is performed constantly while enabled in dacr. if the dadr0 or dadr1 value is modified, conversion of the new data begins immediately. the conversion results are output when bits daoe0 and daoe1 are set to 1. an example of d/a conversion on channel 0 is given next. timing is indicated in figure 21.2. 1. data to be converted is written in dadr0. 2. bit daoe0 is set to 1 in dacr. d/a conversion starts and da0 becomes an output pin. the converted result is output after the conversion time. the output value is (dadr0 contents/256) x avcc. output of this conversion result continues until the value in dadr0 is modified or the daoe0 bit is cleared to 0. 3. if the dadr0 value is modified, conversion starts immediately, and the result is output after the conversion time. 4. when the daoe0 bit is cleared to 0, da0 becomes an input pin. dadr0 write cycle t dconv high-impedance state conversion result 1 conversion data 1 conversion data 2 conversion result 2 t dconv ? address bus dadr0 daoe0 da0 t dconv : d/a conversion time dacr write cycle dadr0 write cycle dacr write cycle legend: figure 21.2 example of d/a converter operation
656
657 section 22 hitachi user-debugging interface (h-udi) 22.1 overview the sh7709a incorporates a hitachi user-debugging interface (h-udi) and advanced user debugger (aud) for program debugging. 22.2 hitachi user debugging interface (h-udi) the h-udi (hitachi user-debugging interface) performs on-chip debugging which is supported by the sh7709a. the h-udi described here is a serial interface which is pin-compatible with jtag (joint test action group, ieee standard 1149.1 and ieee standard test access port and boundary-scan architecture) specifications (restrictions apply to some functions). the h-udi in the sh7709a supports a boundary scan mode, and is also used for emulator connection. when using an emulator, h-udi functions should not be used. refer to the emulator manual for the method of connecting the emulator. 22.2.1 pin description tck: h-udi serial data input/output clock pin. data is serially supplied to the h-udi from the data input pin (tdi), and output from the data output pin (tdo), in synchronization with this clock. tms: mode select input pin. the state of the tap control circuit is determined by changing this signal in synchronization with tck. the protocol conforms to the jtag standard (ieee std. 1140.1). trst : h-udi reset input pin. input is accepted asynchronously with respect to tck, and when low, the h-udi is reset. see section 22.4.2, reset configuration, for more information. tdi: h-udi serial data input pin. data transfer to the h-udi is executed by changing this signal in synchronization with tck. tdo: h-udi serial data output pin. data output from the h-udi is executed by reading this signal in synchronization with tck. asemd0 : ase mode select pin. if a low level is input at the asemd0 pin while the resetp pin is asserted, ase mode is entered; if a high level is input, normal operation mode is entered. asemd0 pin should be high level when an emulator or h-udi is not used. in ase mode,
658 boundary scan and emulator functions can be used. the input level at the asemd0 pin should be held for at least one cycle after resetp negation. asebrkak : dedicated emulator pin 22.2.2 block diagram figure 22.1 shows the block diagram of the h-udi. sdir tck tdo tdi tms trst sdbpr mux sdbsr shift register tap controller decoder local bus figure 22.1 h-udi block diagram 22.3 register descriptions the h-udi has the following registers. ? sdbpr: bypass register ? sdir: instruction register ? sdbsr: boundary scan register
659 table 22.1 shows h-udi register configuration. table 22.1 h-udi registers cpu side h-udi side initial name abbreviation r/w size address r/w size value * bypass register sdbpr r/w 1 undefined instruction register sdir r 16 h04000200 r/w 16 hffff boundary register sdbsr r/w undefined note: * initialized when trst pin is low or when tap is in the test-logic-reset state. 22.3.1 bypass register (sdbpr) the bypass register is a 1-bit register that cannot be accessed by the cpu. when the sdir is set to the bypass mode, the sdbpr is connected between h-udi pins tdi and tdo. 22.3.2 instruction register (sdir) the instruction register (sdir) is a 16-bit read-only register. the register is in bypass mode in its initial state. it is initialized by trst or in the tap test-logic-reset state, and can be written by the h-udi irrespective of the cpu mode. operation is not guaranteed when a reserved command is set to this register bit: 15 14 13 12 11 10 9 8 ti3 ti2 ti1 ti0 initial value: 1 1 1 1 1 1 1 1 bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 bits 15 to 12test instruction bits (ti3Cti0): cannot be written by the cpu.
660 table 22.2 h-udi commands ti3ti2 ti1 ti0 description 0000 extest 0100 sample/preload 0101 reserved 0110 h-udi reset negate 0111 h-udi reset assert 100 reserved 101 h-udi interrupt 110 reserved 1110 reserved 1111 bypass mode (initial value) 0001 recovery from sleep bits 11 to 0reserved: always read 1. 22.3.3 boundary scan register (sdbsr) the boundary scan register (sdbsr) is a shift register, located on the pad, for controlling the input/output pins of the sh7709a. using the extest and sample/preload commands, a boundary scan test conforming to the jtag standard can be carried out. table 22.3 shows the correspondence between sh7709a pins and boundary scan register bits.
661 table 22.3 sh7709a pins and boundary scan register bits bit pin name i/o bit pin name i/o from tdi 308 d1 in 338 d31/ptb7 in 307 d0 in 337 d30/ptb6 in 306 md1 in 336 d29/ptb5 in 305 md2 in 335 d28/ptb4 in 304 nmi in 334 d27/ptb3 in 303 irq0/ irl0 /pth0 in 333 d26/ptb2 in 302 irq1/ irl1 /pth1 in 332 d25/ptb1 in 301 irq2/ irl2 /pth2 in 331 d24/ptb0 in 300 irq3/ irl3 /pth3 in 330 d23/pta7 in 299 irq4/pth4 in 329 d22/pta6 in 298 d31/ptb7 out 328 d21/pta5 in 297 d30/ptb6 out 327 d20/pta4 in 296 d29/ptb5 out 326 d19/pta3 in 295 d28/ptb4 out 325 d18/pta2 in 294 d27/ptb3 out 324 d17/pta1 in 293 d26/ptb2 out 323 d16/pta0 in 292 d25/ptb1 out 322 d15 in 291 d24/ptb0 out 321 d14 in 290 d23/pta7 out 320 d13 in 289 d22/pta6 out 319 d12 in 288 d21/pta5 out 318 d11 in 287 d20/pta4 out 317 d10 in 286 d19/pta3 out 316 d9 in 285 d18/pta2 out 315 d8 in 284 d17/pta1 out 314 d7 in 283 d16/pta0 out 313 d6 in 282 d15 out 312 d5 in 281 d14 out 311 d4 in 280 d13 out 310 d3 in 279 d12 out 309 d2 in 278 d11 out
662 table 22.3 sh7709a pins and boundary scan register bits (cont) bit pin name i/o bit pin name i/o 277 d10 out 247 d12 control 276 d9 out 246 d11 control 275 d8 out 245 d10 control 274 d7 out 244 d9 control 273 d6 out 243 d8 control 272 d5 out 242 d7 control 271 d4 out 241 d6 control 270 d3 out 240 d5 control 269 d2 out 239 d4 control 268 d1 out 238 d3 control 267 d0 out 237 d2 control 266 d31/ptb7 control 236 d1 control 265 d30/ptb6 control 235 d0 control 264 d29/ptb5 control 234 bs /ptk4 in 263 d28/ptb4 control 233 we2 /dqmul/ iciord /ptk6 in 262 d27/ptb3 control 232 we3 /dqmuu/ iciord /ptk7 in 261 d26/ptb2 control 231 audsync /pte7 in 260 d25/ptb1 control 230 cs2 /ptk0 in 259 d24/ptb0 control 229 cs3 /ptk1 in 258 d23/pta7 control 228 cs4 /ptk2 in 257 d22/pta6 control 227 cs5 / ce1a /ptk3 in 256 d21/pta5 control 226 ce2a /pte4 in 255 d20/pta4 control 225 ce2b /pte5 in 254 d19/pta3 control 224 a0 out 253 d18/pta2 control 223 a1 out 252 d17/pta1 control 222 a2 out 251 d16/pta0 control 221 a3 out 250 d15 control 220 a4 out 249 d14 control 219 a5 out 248 d13 control 218 a6 out
663 table 22.3 sh7709a pins and boundary scan register bits (cont) bit pin name i/o bit pin name i/o 217 a7 out 187 cs4 /ptk2 out 216 a8 out 186 cs5 /ce1a/ptk3 out 215 a9 out 185 cs6 / ce1b out 214 a10 out 184 ce2a /pte4 out 213 a11 out 183 ce2b /pte5 out 212 a12 out 182 a0 control 211 a13 out 181 a1 control 210 a14 out 180 a2 control 209 a15 out 179 a3 control 208 a16 out 178 a4 control 207 a17 out 177 a5 control 206 a18 out 176 a6 control 205 a19 out 175 a7 control 204 a20 out 174 a8 control 203 a21 out 173 a9 control 202 a22 out 172 a10 control 201 a23 out 171 a11 control 200 a24 out 170 a12 control 199 a25 out 169 a13 control 198 bs/ptk4 out 168 a14 control 197 rd out 167 a15 control 196 we0 /dqmll out 166 a16 control 195 we1 /dqmlu/ we out 165 a17 control 194 we2 /dqmul/ iciord /ptk6 out 164 a18 control 193 we3 /dqmuu/ iciowr /ptk7 out 163 a19 control 192 rd/ wr out 162 a20 control 191 audsync /pte7 out 161 a21 control 190 cs0 /mcs0 out 160 a22 control 189 cs2 /ptk0 out 159 a23 control 188 cs3 /ptk1 out 158 a24 control
664 table 22.3 sh7709a pins and boundary scan register bits (cont) bit pin name i/o bit pin name i/o 157 a25 control 127 breq in 156 bs/ptk4 control 126 wait in 155 rd control 125 audck/pth6 in 154 we0 /dqmll control 124 iois16 /ptg7 in 153 we1 /dqmlu/ we control 123 asebrkak /ptg5 in 152 we2 /dqmul/ iciord /ptk6 control 122 ptg4 in 151 we3 /dqmuu/ iciowr /ptk7 control 121 audata3/ptg3 in 150 rd/ wr control 120 audata2/ptg2 in 149 audsync /pte7 control 119 audata1/ptg1 in 148 cs0 /mcs0 control 118 audata0/ptg0 in 147 cs2 /ptk0 control 117 adtrg /pth5 in 146 cs3 /ptk1 control 116 irls3 /ptf3/pint11 in 145 cs4 /ptk2 control 115 irls2 /ptf2/pint10 in 144 cs5 / ce1a /ptk3 control 114 irls1 /ptf1/pint9 in 143 cs6 / ce1b control 113 irls0 /ptf0/pint8 in 142 ce2a /pte4 control 112 md0 in 141 ce2b /pte5 control 111 cke/ptk5 out 140 cke/ptk5 in 110 ras3l /ptj0 out 139 ras3l /ptj0 in 109 ras2l /ptj1 out 138 ras2l /ptj1 in 108 casll / casl /ptj2 out 137 casll / casl /ptj2 in 107 caslh / casu /ptj3 out 136 caslh / casu /ptj3 in 106 cashl /ptj4 out 135 cashl /ptj4 in 105 cashh /ptj5 out 134 cashh /ptj5 in 104 dack0 /ptd5 out 133 dack0 /ptd5 in 103 dack1 /ptd7 out 132 dack1 /ptd7 in 102 cas2l /pte6 out 131 cas2l /pte6 in 101 cas2h /pte3 out 130 cas2h /pte3 in 100 ras3u /pte2 out 129 ras3u /pte2 in 99 ras2u /pte1 out 128 ras2u /pte1 in 98 back out
665 table 22.3 sh7709a pins and boundary scan register bits (cont) bit pin name i/o bit pin name i/o 97 asebrkak/ptg5 out 65 rxd2/scpt4 in 96 audata3/ptg3 out 64 wakeup /ptd3 in 95 audata2/ptg2 out 63 resetout /ptd2 in 94 audata1/ptg1 out 62 drak0/ptd1 in 93 audata0/ptg0 out 61 drak1/ptd0 in 92 cke/ptk5 control 60 dreq0 /ptd4 in 91 ras3l /ptj0 control 59 dreq1 /ptd6 in 90 ras2l /ptj1 control 58 rxd1/scpt2 in 89 casll / casl /ptj2 control 57 cts2 /irq5/scpt7 in 88 caslh / casu /ptj3 control 56 mcs7 /ptc7/pint7 in 87 cashl /ptj4 control 55 mcs6 /ptc6/pint6 in 86 cashh /ptj5 control 54 mcs5 /ptc5/pint5 in 85 dack0 /ptd5 control 53 mcs4 /ptc4/pint4 in 84 dack1 /ptd7 control 52 mcs3 /ptc3/pint3 in 83 cas2l /pte6 control 51 mcs2 /ptc2/pint2 in 82 cas2h /pte3 control 50 mcs1 /ptc1/pint1 in 81 ras3u /pte2 control 49 mcs0 /ptc0/pint0 in 80 ras2u /pte1 control 48 md3 in 79 back control 47 md4 in 78 asebrkak /ptg5 control 46 md5 in 77 audata3/ptg3 control 45 status0/ptj6 out 76 audata2/ptg2 control 44 status1/ptj7 out 75 audata1/ptg1 control 43 tclk/pth7 out 74 audata0/ptg0 control 42 irqout out 73 status0/ptj6 in 41 txd0/scpt0 out 72 status1/ptj7 in 40 sck0/scpt1 out 71 tclk/pth7 in 39 txd1/scpt2 out 70 sck0/scpt1 in 38 sck1/scpt3 out 69 sck1/scpt3 in 37 txd2/scpt4 out 68 sck2/scpt5 in 36 sck2/scpt5 out 67 rts2 /scpt6 in 35 rts2/scpt6 out 66 rxd0/scpt0 in 34 mcs7 /ptc7/pint7 out
666 table 22.3 sh7709a pins and boundary scan register bits (cont) bit pin name i/o bit pin name i/o 33 mcs6 /ptc6/pint6 out 15 sck1/scpt3 control 32 mcs5 /ptc5/pint5 out 14 txd2/scpt4 control 31 mcs4 /ptc4/pint4 out 13 sck2/scpt5 control 30 wakeup /ptd3 out 12 rts2/scpt6 control 29 resetout /ptd2 out 11 mcs7 /ptc7/pint7 control 28 mcs3 /ptc3/pint3 out 10 mcs6 /ptc6/pint6 control 27 mcs2 /ptc2/pint2 out 9 mcs5 /ptc5/pint5 control 26 mcs1 /ptc1/pint1 out 8 mcs4 /ptc4/pint4 control 25 mcs0 /ptc0/pint0 out 7 wakeup /ptd3 control 24 drak0/ptd1 out 6 resetout /ptd2 control 23 drak1/ptd0 out 5 mcs3 /ptc3/pint3 control 22 status0/ptj6 control 4 mcs2 /ptc2/pint2 control 21 status1/ptj7 control 3 mcs1 /ptc1/pint1 control 20 tclk/pth7 control 2 mcs0 /ptc0/pint0 control 19 irqout control 1 drak0/ptd1 control 18 txd0/scpt0 control 0 drak1/ptd0 control 17 sck0/scpt1 control to tdo 16 txd1/scpt2 control note: control is an active-low signal. when control is driven low, the corresponding pin is driven by the value of out.
667 22.4 h-udi operations 22.4.1 tap controller figure 22.2 shows the internal states of tap controller. state transitions basically conform with the jtag standard. test-logic-reset capture-dr shift-dr exit1-dr pause-dr exit2-dr update-dr select-dr-scan run-test/idle 1 0 0 0 0 11 1 1 0 0 1 0 1 1 10 capture-ir shift-ir exit1-ir pause-ir exit2-ir update-ir select-ir-scan 0 0 1 0 0 1 0 1 1 10 0 figure 22.2 tap controller state transitions note: the transition condition is the tms value on the rising edge of tck. the tdi value is sampled on the rising edge of tck; shifting occurs on the falling edge of tck. the tdo value changes on the tck falling edge. the tdo is at high impedance, except with shift- dr (shift-sr) and shift-ir states. during the change to trstn = 0, there is a transition to test-logic-reset asynchronously with tck.
668 22.4.2 reset configuration table 22.4 reset configuration asdmd0 * 1 resetp trst chip state h l l normal reset and h-udi reset h normal reset h l h-udi reset only h normal operation l l l reset hold * 2 h normal reset h l h-udi reset only h normal operation notes: * 1 performs normal operation mode and ase mode settings asemd0 = h, normal operation mode asemd0 = l, ase mode asemd0 pin should be high level when an emulator or h-udi is not used. * 2 during ase mode, reset hold is enabled by setting resetp and trst pins at low level for a constant cycle. in this state, the cpu does not start up, even if resetp is set to high level. when trst is set to high level, h-udi operation is enabled, but the cpu does not start up. the reset hold state is cancelled by the following: ? boot request from h-udi (boot sequence) ? another resetp assert (power-on reset)
669 22.4.3 h-udi reset an h-udi reset is executed by setting an h-udi reset assert command in sdir. an h-udi reset is of the same kind as a power-on reset. an h-udi reset is released by inputting an h-udi reset negate command. the interval required between the h-udi reset assert command and the h-udi reset negate command is the same as the time for which the resetp pin is held low in order to execute a power-on reset. h-udi reset assert h-udi reset negate sdir chip internal reset cpu state branch to h'a0000000 figure 22.3 h-udi reset 22.4.4 h-udi interrupt the h-udi interrupt function generates an interrupt by setting a command from the h-udi in the sdir. an h-udi interrupt is a general exception/interrupt operation, resulting in a branch to an address based on the vbr value plus offset, and return by the rte instruction. this interrupt request has a fixed priority level of 15. h-udi interrupts are not accepted in sleep mode or standby mode. 22.4.5 bypass the jtag-based bypass mode for the h-udi pins can be selected by setting a command from the h-udi in the sdir. 22.4.6 using h-udi to recover from sleep mode it is possible to recover from sleep mode by setting a command (0001) from the h-udi in sdir.
670 22.5 boundary scan a command can be set in sdir by the h-udi to place the h-udi pins in the boundary scan mode stipulated by jtag. 22.5.1 supported instructions the sh7709a supports the three essential instructions defined in the jtag standard (bypass, sample/preload, and extest). bypass: the bypass instruction is an essential standard instruction that operates the bypass register. this instruction shortens the shift path to speed up serial data transfer involving other chips on the printed circuit board. while this instruction is executing, the test circuit has no effect on the system circuits. the instruction code is 1111. sample/preload: the sample/preload instruction inputs values from the sh7709a's internal circuitry to the boundary scan register, outputs values from the scan path, and loads data onto the scan path. when this instruction is executing, the sh7709a's input pin signals are transmitted directly to the internal circuitry, and internal circuit values are directly output externally from the output pins. the sh7709a's system circuits are not affected by execution of this instruction. the instruction code is 0100. in a sample operation, a snapshot of a value to be transferred from an input pin to the internal circuitry, or a value to be transferred from the internal circuitry to an output pin, is latched into the boundary scan register and read from the scan path. snapshot latching is performed in synchronization with the rise of tck in the capture-dr state. snapshot latching does not affect normal operation of the sh7709a. in a preload operation, an initial value is set in the parallel output latch of the boundary scan register from the scan path prior to the extest instruction. without a preload operation, when the extest instruction was executed an undefined value would be output from the output pin until completion of the initial scan sequence (transfer to the output latch) (with the extest instruction, the parallel output latch value is constantly output to the output pin). extest: this instruction is provided to test external circuitry when the sh7709a is mounted on a printed circuit board. when this instruction is executed, output pins are used to output test data (previously set by the sample/preload instruction) from the boundary scan register to the printed circuit board, and input pins are used to latch test results into the boundary scan register from the printed circuit board. if testing is carried out by using the extest instruction n times, the nth test data is scanned-in when test data (n-1) is scanned out.
671 data loaded into the output pin boundary scan register in the capture-dr state is not used for external circuit testing (it is replaced by a shift operation). the instruction code is 0000. 22.5.2 notes on use 1. boundary scan mode does not cover clock-related signals (extal, extal2, xtal, xtal2, ckio). 2. boundary scan mode does not cover reset-related signals ( resetp , resetm , ca). 3. boundary scan mode does not cover h-udi-related signals (tck, tdi, tdo, tms, trst). 4. when a boundary scan test is carried out, ensure that the ckio clock operates constantly. the ckio frequency range is as follows: minimum: 1 mhz maximum: maximum frequency for respective clock mode specified in the cpg section set pins md[2:0] to the clock mode to be used. after powering on, wait for the ckio clock to stabilize before performing a boundary scan test. 5. fix the resetp pin low. 6. fix the ca pin high, and the asemd0 pin low.
672 22.6 notes on use 1. an h-udi command other than an h-udi interrupt, once set, will not be modified as long as another command is not re-issued from the h-udi. an h-udi interrupt command, however, will be changed to a bypass command once set. 2. because chip operations are suspended in standby mode, h-udi commands are not accepted. however, the tap controller remains in operation at this time. 3. the h-udi is used for emulator connection. therefore, h-udi functions cannot be used when using an emulator. 22.7 advanced user debugger (aud) the aud is a function exclusively for use by an emulator. refer to the user's manual for the relevant emulator for details of the aud.
673 section 23 electrical characteristics 23.1 absolute maximum ratings table 23.1 shows the absolute maximum ratings. table 23.1 absolute maximum ratings item symbol rating unit power supply voltage (i/o) vccq C0.3 to 4.2 v power supply voltage (internal) vcc vcc C pll1 vcc C pll2 vcc C rtc C0.3 to 2.5 v input voltage (except port l) vin C0.3 to vccq + 0.3 v input voltage (port l) vin C0.3 to avcc + 0.3 v analog power-supply voltage avcc C0.3 to 4.6 v analog input voltage v an C0.3 to avcc + 0.3 v operating temperature topr C20 to 75 c storage temperature tstr C55 to 125 c caution: operating the chip in excess of the absolute maximum rating may result in permanent damage. ? order of turning on 1.8 v/1.9 v power (vcc, vcc-pll1, vcc-pll2, vcc-rtc) and 3.3 v power (vccq, avcc): 1. first turn on the 3.3 v power, then turn on the 1.8 v/1.9 v power within 1 ms. this interval should be as short as possible. 2. until voltage is applied to all power supplies, a high level is input at the ca pin, a low level is input at the resetp pin, and ckio clock operates in 50 cycles, internal circuits remain unsettled, and so pin states are also undefined. the system design must ensure that these undefined states do not cause erroneous system operation. when a low level is input at the ca pin, a low level input at the resetp pin is not accepted. waveforms at power-on are shown in the following figure.
674 pin states undefined (max. 1 ms) 3.3 v 1.8 v/1.9 v 3.3 v power 1.8 v/1.9 v power ca all other pins * pin states undefined power-on reset state  !

!01 !0 resetp note: * except power/gnd, clock related, and analog pins power-on sequence ? power-off order 1. in the reverse order of powering-on, first turn off the 1.8 v/1.9 v power, then turn off the 3.3 v power within 1 ms. this interval should be as short as possible. 2. pin states are undefined while only the 1.8 v/1.9 v power is off. the system design must ensure that these undefined states do not cause erroneous system operation.
675 23.2 dc characteristics tables 23.2 and 23.3 list dc characteristics. table 23.2 dc characteristics (ta = C20 to 75c) item symbol min typ max unit measurement conditions power supply voltage vccq 3.0 3.3 3.6 v vcc, vcc-pll1, vcc-pll2, 1.75 1.90 2.05 133 mhz model vcc-rtc 1.65 1.80 2.05 100 mhz model current dissipation normal operation icc 210 350 ma vcc = 1.9 v, i = 133 mhz 150 250 vcc = 1.8 v, i = 100 mhz iccq 20 40 vccq = 3.3 v, b = 33 mhz in sleep icc 10 20 b = 33mhz mode * 1 iccq 15 30 in standby mode icc 40 120 a ta = 25c (rtc on) * 2 vccq = 3.3 v, iccq 10 30 vcc = 1.9 v/1.8 v icc 35 110 ta = 25c (rtc off) vccq = 3.3 v, iccq 10 30 vcc = 1.9 v/1.8 v input high voltage resetp , resetm , nmi, irq5C irq0, md5Cmd0, asemd0 , ca, rxd1, adtrg , pint15C pint0, extal, ckio v ih vccq 0.9 vccq + 0.3 v port l 2.0 avcc + 0.3 other input pins 2.0 vccq + 0.3
676 table 23.2 dc characteristics (ta = C20 to 75c) (cont) item symbol min typ max unit measurement conditions input low voltage resetp , resetm , nmi, irq5Cirq0, md5Cmd0, asemd0 , ca, rxd1, adtrg , pint[15]C pint[0], extal, ckio v il C0.3 vccq 0.1 v port l C0.3 avcc 0.2 other input pins C0.3 vccq 0.2 input leak current all input pins i iin i 1.0 a vin = 0.5 to vccqC0.5 v three- state leak current i/o, all output pins (off condition) i isti i 1.0 a vin = 0.5 to vccqC0.5 v output high voltage all output pins (except da1, da0) v oh 2.4 v vccq = 3.0 v, ioh = C200 a 2.0 vccq = 3.0 v, ioh = C2 ma output low voltage all output pins (except da1, da0) v ol 0.55 vccq = 3.6 v, iol = 1.6 ma pull-up resistance port pin ppull 30 60 120 k ? pin capacity all pins c 10 pf analog power- supply voltage avcc 3.0 3.3 3.6 v
677 table 23.2 dc characteristics (ta = C20 to 75c) (cont) item symbol min typ max unit measurement conditions analog power- supply during a/d conversion aicc 0.8 2 ma current during a/d and d/a conversion 2.4 6 ma idle 0.01 5.0 a notes: 1. no external bus cycles except refresh cycles. 2. conditions include hardware standby mode. 3. regardless of whether pll or rtc is used, connect vcc C pll and vcc C rtc to vcc, and vss C pll and vss C rtc to vss. 4. avcc must be under condition of vccq C 0.3 v avcc vccq + 0.3 v. if the a/d and d/a converters are not used, do not leave the avcc and avss pins open. connect avcc to vccq, and connect avss to vssq. 5. current dissipation values shown are the values at which all output pins are without load under conditions of vihmin = vccq C 0.5 v, vilmax = 0.5 v. 6. supply the same voltage to vcc, vcc-pll1, vcc-pll2, and vcc-rtc. table 23.3 permitted output current values (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) item symbol min typ max unit output low-level permissible current (per pin) i ol 2.0 ma output low-level permissible current (total) i ol 120 ma output high-level permissible current (per pin) Ci oh 2.0 ma output high-level permissible current (total) (Ci oh )40ma caution: to ensure lsi reliability, do not exceed the value for output current given in table 23.3.
678 23.3 ac characteristics in general, inputting for this lsi should be clock synchronous. keep the setup and hold times for each input signal unless otherwise specified. table 23.4 maximum operating frequencies (vccq = 3.3 0.3 v, vccq = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) item symbol min * typ max unit remarks operating cpu, cache, tlb f 16 133.34 mhz 133 mhz model frequency 100 100 mhz model external bus 16 66.67 peripheral module 4 33.34 note: * the min value depends on the clock mode used. see table 9.4, available combinations of clock mode and frqcr values.
679 23.3.1 clock timing table 23.5 clock timing (1) (vccq = 3.3 0.3 v, vccq = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 20 mhz) item symbol min max unit figure extal clock input frequency f ex 5 20 mhz 23.1 extal clock input cycle time t excyc 50 200 ns extal clock input low pulse width t exl 8ns extal clock input high pulse width t exh 8ns extal clock input rise time t exr 4ns extal clock input fall time t exf 4ns ckio clock input frequency f cki 20 20 mhz 23.2 ckio clock input cycle time t ckicyc 50 50 ns ckio clock input low pulse width t ckil 8ns ckio clock input high pulse width t ckih 8ns ckio clock input rise time t ckir 4ns ckio clock input fall time t ckif 4ns ckio clock output frequency f op 16 20 mhz 23.3 ckio clock output cycle time t cyc 50 62.5 ns ckio clock output low pulse width t ckol 20 ns ckio clock output high pulse width t ckoh 20 ns ckio clock output rise time t ckor 7ns ckio clock output fall time t ckof ns power-on oscillation settling time t osc1 10 ms 23.4 resetp setup time t resps 20 ns 23.4, 23.5 resetm setup time t resms 0ns resetp assert time t respw 20 tcyc resetm assert time t resmw 20 tcyc standby return oscillation settling time 1 t osc2 10 ms 23.5 standby return oscillation settling time 2 t osc3 10 ms 23.6 standby return oscillation settling time 3 t osc4 11 ms 23.7
680 table 23.5 clock timing (1) (cont) (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 20 mhz) item symbol min max unit figure pll synchronization settling time 1 (standby canceled) t pll1 100 s 23.8, 23.9 pll synchronization settling time 2 (multiplication rate modified) t pll2 100 s 23.10 irq/irl interrupt determination time (rtc used and standby mode) t irlstb 100 s 23.10
681 table 23.5 clock timing (2) (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 33 mhz) item symbol min max unit figure extal clock input frequency f ex 5 33 mhz 23.1 extal clock input cycle time t excyc 30.3 200 ns extal clock input low pulse width t exl 7ns extal clock input high pulse width t exh 7ns extal clock input rise time t exr 4ns extal clock input fall time t exf 4ns ckio clock input frequency f cki 20 33 mhz 23.2 ckio clock input cycle time t ckicyc 30.3 50 ns ckio clock input low pulse width t ckil 7ns ckio clock input high pulse width t ckih 7ns ckio clock input rise time t ckir 3ns ckio clock input fall time t ckif 3ns ckio clock output frequency f op 16 33 mhz 23.3 ckio clock output cycle time t cyc 30.3 50 ns ckio clock output low pulse width t ckol 8ns ckio clock output high pulse width t ckoh 8ns ckio clock output rise time t ckor 6ns ckio clock output fall time t ckof 6ns power-on oscillation settling time t osc1 10 ms 23.4 resetp setup time t resps 20 ns 23.4, 23.5 resetm setup time t resms 0ns resetp assert time t respw 20 tcyc resetm assert time t resmw 20 tcyc standby return oscillation settling time 1 t osc2 10 ms 23.5 standby return oscillation settling time 2 t osc3 10 ms 23.6 standby return oscillation settling time 3 t osc4 11 ms 23.7 pll synchronization settling time 1 (standby canceled) t pll1 100 s 23.8, 23.9 pll synchronization settling time 2 (multiplication rete modified) t pll2 100 s 23.10 irq/irl interrupt determination time (rtc used and standby mode) t irlstb 100 s 23.10
682 table 23.5 clock timing (3) (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 66 mhz) item symbol min max unit figure extal clock input frequency f ex 5 66 mhz 23.1 extal clock input cycle time t excyc 15.2 200 ns extal clock input low pulse width t exl 4ns extal clock input high pulse width t exh 4ns extal clock input rise time t exr 2ns extal clock input fall time t exf 2ns ckio clock input frequency f cki 20 66 mhz 23.2 ckio clock input cycle time t ckicyc 15.2 50 ns ckio clock input low pulse width t ckil 4ns ckio clock input high pulse width t ckih 4ns ckio clock input rise time t ckir 2ns ckio clock input fall time t ckif 2ns ckio clock output frequency f op 16 66 mhz 23.3 ckio clock output cycle time t cyc 15.2 62.5 ns ckio clock output low pulse width t ckol 3ns ckio clock output high pulse width t ckoh 3ns ckio clock output rise time t ckor 5ns ckio clock output fall time t ckof 5ns power-on oscillation settling time t osc1 10 ms 23.4 resetp setup time t resps 20 ns 23.4, 23.5 resetm setup time t resms 0 tcyc resetp assert time t respw 20 tcyc resetm assert time t resmw 20 ns standby return oscillation settling time 1 t osc2 10 ms 23.5 standby return oscillation settling time 2 t osc3 10 ms 23.6 standby return oscillation settling time 3 t osc4 11 ms 23.7 pll synchronization settling time 1 (standby canceled) t pll1 100 s 23.8, 23.9 pll synchronization settling time 2 (multiplication rete modified) t pll2 100 s 23.10 irq/irl interrupt determination time (rtc used and standby mode) t irlstb 100 s 23.10
683 t exh t exf t exr t exl t excyc v ih v ih v ih 1/2 v cc 1/2 v cc v il v il extal * (input) note: * the clock input from the extal pin. figure 23.1 extal clock input timing t ckih t ckif t ckir t ckil t ckicyc v ih 1/2 v cc 1/2 v cc v ih v il v ih v il ckio (input) figure 23.2 ckio clock input timing t cyc t ckol t ckoh v ih 1/2v cc ckio (output) 1/2v cc t ckor t ckof v oh v ol v ol v oh figure 23.3 ckio clock output timing
684 v cc min t resp/mw t resp/ms t osc1 v cc resetp resetm ckio, internal clock stable oscillation note: oscillation settling time when built-in oscillator is used figure 23.4 power-on oscillation settling time ckio, internal clock stable oscillation standby t osc2 t resp/mw resetp resetm note: oscillation settling time when built-in oscillator is used figure 23.5 oscillation settling time at standby return (return by reset)
685 ckio, internal clock stable oscillation standby t osc3 nmi note: oscillation settling time when built-in oscillator is used wakeup figure 23.6 oscillation settling time at standby return (return by nmi) ckio, internal clock stable oscillation standby t osc4 irq4 to irq0 pint0/1 note: oscillation settling time when built-in oscillator is used wakeup figure 23.7 oscillation settling time at standby return (return by irq4 to irq0)
686 extal input or ckio input stable input clock reset or nmi interrupt request stable input clock normal normal standby pll output, ckio output internal clock status 0 status 1 pll synchronization note: pll oscillation settling time when clock is input from extal pin or ckio pin t pll1 pll synchronization figure 23.8 pll synchronization settling time by reset or nmi extal input or ckio input stable input clock irq4 C irq0/ irl3 C irl0 interrupt request stable input clock normal normal pll output, ckio output internal clock status 0 status 1 note: pll oscillation settling time when clock is input from extal pin or ckio pin t pll1 pll synchronization standby pll synchronization t irlstb figure 23.9 pll synchronization settling time by irq/irl interrupt
687 extal input * 1 pll output, ckio output * 2 internal clock multiplication rate modified t pll2 notes: * 1 ckio input in clock mode 7 * 2 pll output in clock mode 7 figure 23.10 pll synchronization settling time when frequency multiplication rate modified
688 23.3.2 control signal timing table 23.6 control signal timing (vcc = 3.3 0.3 v, vcc (1.8 v) = 3.3 0.3 v, avcc = 3.3 0.3 v, ta = C20 to 75c) C66 * 2 item symbol min max unit figure resetp pulse width t respw 20 * 3 tcyc 23.11, resetp setup time * 1 t resps 23 ns 23.12 resetp hold time t resph 2ns resetm pulse width t resmw 12 * 4 tcyc resetm setup time t resms 3ns resetm hold time t resmh 34 ns breq setup time t breqs 10 ns 23.14 breq hold time t breqh 3ns nmi setup time * 1 t nmis 10 ns 23.12, nmi hold time t nmih 4 ns 23.13 irq5Cirq0 setup time * 1 t irqs 10 ns irq5Cirq0 hold time t irqh 4ns irqout delay time t irqod 12ns back delay time t backd 10 ns 23.14, status1, status0 delay time t std 16 ns 23.15 bus tri-state delay time 1 t boff1 015ns bus tri-state delay time 2 t boff2 015ns bus buffer-on time 1 t bon1 015ns bus buffer-on time 2 t bon2 015ns notes: * 1 resetp , nmi, and irq5 to irq0 are asynchronous. changes are detected at the clock fall when the setup shown is used. when the setup cannot be used, detection can be delayed until the next clock falls. * 2 the upper limit of the external bus clock is 66 mhz. * 3 in the standby mode, t respw = t osc2 (10 ms). in the sleep mode, t respw = t pll1 (100 s). when the clock multiplication ratio is changed, t respw = t pll1 (100 s). * 4 in the standby mode, t resmw = t osc2 (10 ms). in the sleep mode, resetm must be kept low until status (0-1) changes to reset (hh). when the clock multiplication ratio is changed, resetm must be kept low until status (0-1) changes to reset (hh).
689 ckio t resps/ms t resps/ms resetp resetm t respw/mw figure 23.11 reset input timing ckio resetp resetm t resph/mh t resps/ms v ih v il nmi t nmih t nmis v ih v il irq5 to irq0 t irqh t irqs v ih v il figure 23.12 interrupt signal input timing ckio t irqod t irqod irqout figure 23.13 irqout timing
690 ckio breq back rd , rd/ wr , ras , cas , csn , wen , bs , a25 to a0, d31 to d0 t backd t boff2 t boff1 t bon1 t backd t bon2 t breqh t breqh t breqs t breqs mcsn figure 23.14 bus release timing ckio t std t boff2 t boff1 t std t bon2 t bon1 normal mode standby mode normal mode status 0 status 1 rd , rd/ wr , ras , cas , csn , wen , bs , mcsn a25 to a0, d31 to d0 figure 23.15 pin drive timing at standby
691 23.3.3 ac bus timing table 23.7 bus timing (clock modes 0/1/2/3/4/7, vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) C66 * item symbol min max unit figure address delay time t ad 2 13 ns 23.16C23.29, 23.35C23.49, 23.52C23.59 address setup time t as 0 ns 23.16C23.18(2), 23.22C23.29 address hold time t ah 7 ns 23.16C23.29 bs delay time t bsd 12 ns 23.16C23.29, 23.35C23.49, 23.52C23.59 cs delay time 1 t csd1 2 12 ns 23.16C23.29, 23.35C23.49, 23.52C23.59 cs delay time 2 t csd2 1 12 ns 23.16C23.21 read/write delay time t rwd 2 10 ns 23.16C23.29, 23.35C23.49, 23.52C23.59 read/write hold time t rwh 0 ns 23.16C23.29 read strobe delay time t rsd 10 ns 23.16C23.21 23.53C23.59 read data setup time 1 t rds1 12 ns 23.16C23.25, 23.53C23.59 read data setup time 2 t rds2 7 ns 23.26C23.29, 23.35C23.38 read data setup time 3 t rds3 12 ns 23.30 read data setup time 4 t rds4 12 ns 23.31 read data hold time 1 t rdh1 0 ns 23.16C23.25, 23.53C23.59 read data hold time 2 t rdh2 2 ns 23.26C23.29, 23.35C23.38, 23.43C23.47 read data hold time 3 t rdh3 0 ns 23.30 read data hold time 4 t rdh4 6 ns 23.31 write enable delay time t wed 1 10 ns 23.16C23.18, 23.53C23.54 write data delay time 1 t wdd1 14 ns 23.16C23.18, 23.53C23.54, 23.57C23.59 write data delay time 2 t wdd2 13 ns 23.22C23.29, 23.39C23.42 write data setup time t wds 0 ns 23.22C23.29
692 table 23.7 bus timing (cont) (clock modes 0/ 1/ 2/ 3/4/ 7, vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) C66 * item symbol min max unit figure write data hold time 1 t wdh1 2 ns 23.16C23.18, 23.22C23.29, 23.53C23.59 write data hold time 2 t wdh2 2 ns 23.39C23.42 write data hold time 3 t wdh3 2 ns 23.16C23.18, 23.22C23.29 write data hold time 4 t wdh4 2 ns 23.53C23.59 wait setup time t wts 12 ns 23.17C23.21, 23.54, 23.56, 23.58, 23.59 wait setup time 2 t wts2 5 ns 23.18(2) wait hold time t wth 0 ns 23.17C23.21, 23.46, 23.56, 23.58, 23.59 ras delay time 1 t rasd1 1 13 ns 23.22C23.32 ras delay time 2 t rasd2 1 13 ns 23.26C23.30, 23.35C23.52 cas delay time 1 t casd1 1 13 ns 23.22C23.29, 23.32C23.24 cas delay time 2 t casd2 1 13 ns 23.35C23.52 cas delay time 3 t casd3 1 13 ns 23.30C23.31 cas delay time 4 t casd4 1 13 ns 23.30C23.31 dqm delay time t dqmd 2 10 ns 23.35C23.49 cke delay time t cked 12 ns 23.51 iciord delay time t icrsd 12 ns 23.57C23.59 iciowr delay time t icwsd 12 ns 23.57C23.59 iois16 setup time t io16s 12 ns 23.58, 23.59 iois16 hold time t io16h 4 ns 23.58, 23.59 dack delay time 1 t dakd1 12 ns 23.16C23.31, 23.53C23.59 note: * the upper limit of the external bus clock is 66 mhz.
693 23.3.4 basic timing t 1 ckio a25 to a0 csn rd/ wr rd d31 to d0 (read) wen d31 to d0 (write) bs t 2 t ad t ah t ad t csd1 t rwd t rsd t csd2 t wed t wdd1 t rds1 t bsd t bsd t dakd1 t dakd1 t rdh1 t rdh1 t wed t rsd t ah t rwh t rwd t wdh1 t rwh t rwh t ah t wdh3 dackn (read) (write) t as figure 23.16 basic bus cycle (no wait)
694 t 1 t w t 2 ckio a25 to a0 csn rd/ wr rd d31 to d0 (read) wen d31 to d0 (write) bs wait t ad t ad t rwd t rwh t ah t ah t rsd t csd1 t wed t wdd1 t bsd t wts t wth t bsd t rds1 t csd2 t wed t rsd t rdh1 t rdh1 t rwd t ah t rwh t wdh3 t wdh1 t rwh t dakd1 t dakd1 dackn (read) (write) t as figure 23.17 basic bus cycle (one wait)
695 t 1 t w t w t 2 ckio a25 to a0 csn rd/ wr rd d31 to d0 (read) wen d31 to d0 (write) bs wait t ad t ad t rwd t rsd t wed t wts t wth t bsd t bsd t rds1 t wts t wth t csd1 t csd2 t rsd t wed t rdh1 t ah t rwh t rdh1 t ah t rwh t rwd t rwh t ah t wdh3 t wdh1 t dakd1 t dakd1 dackn t wdd1 (read) (write) t as figure 23.18 (1) basic bus cycle (external wait, waitsel = 0)
696 t 1 t w t w t 2 ckio a25 to a0 csn rd/ wr rd d31 to d0 (read) wen d31 to d0 (write) bs wait t ad t ad t rwd t rsd t wed t wts2 t wth t bsd t bsd t rds1 t wts2 t wth t csd1 t csd2 t rsd t wed t rdh1 t ah t rwh t rdh1 t ah t rwh t rwd t rwh t ah t wdh3 t wdh1 t dakd1 t dakd1 dackn t wdd1 (read) (write) t as figure 23.18 (2) basic bus cycle (external wait, waitsel = 1)
697 23.3.5 burst rom timing ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs dackn wait t ad t ad t ad t ad t csd1 t rwd t bsd t bsd t ah t bsd t dakd1 t dakd1 t csd2 t rsd t rds1 t wts t wth t rds t rsd t 1 t b2 t b1 t b2 t b1 t b2 t b1 t 2 t rsd t rdh1 t rsd t ah t rdh1 t rwh t ah t rwh t rwd t rdh1 t bsd note: in the write cycle, the basic bus cycle, the basic bus cycle is performed. figure 23.19 burst rom bus cycle (no wait)
698 ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs wait dackn t ad t ad t ad t csd1 t rwh t rwd t rsd t rsd t rdh1 t rdh1 t rds1 t bsd t dakd1 t dakd1 t bsd t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t 1 t w t w t b2 t b1 t b2 t w t 2 t 2 t csd2 t rds1 t rsd t rsd t ah t ah t rdh1 t ah t rsd t rwd t rwh t rdh1 note: in the write cycle, the basic bus cycle is performed. figure 23.20 burst rom bus cycle (two waits)
699 ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs dackn wait t 1 t w t w t b2 t b1 t 2 t bw t ad t ad t csd1 t csd2 t rwd t rwh t rdh1 t ah t ah t rwd t rsd t rsd1 t ah t ad t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t bsd t bsd t rds1 t rdh1 t rsd t dakd1 t dakd1 t rdh1 t rwh t rsd1 t rds note: in the write cycle, the basec bus cycle is performed. figure 23.21 burst rom bus cycle (external wait, waitsel = 0)
700 23.3.6 dram timing t ad t ad t bsd t csd1 t csd1 t bsd t rds1 t r t c1 t c2 (t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31 to d0 (read) d31 to d0 (write) cs2 or cs3 bs dackn row address t ad t rwd t ah t ad t as t as row address column address t rasd1 t casd1 t rasd1 t rwh t rwh t ah t casd1 t rdh1 t wdd2 t rwd t dakd1 t dakd1 t wdh3 t wdh1 t wds t ah figure 23.22 dram bus cycle (trcd = 0, anw = 1, tpc = 0)
701 t wdh1 t wdh3 t bsd t csd1 t csd1 t rds1 t r t rw t rw t c1 t cw t c2 (t pc )(t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31 to d0 (read) d31 to d0 (write) cs2 or cs3 bs t ad t ad t ad t as t ad t as row address row address column address t rasd1 t rasd1 t rwh t rwh t ah t casd1 t casd1 t rwd t ah t rdh1 t wdd2 t rwd dackn t dakd1 t dakd1 t bsd t wds t ah figure 23.23 dram bus cycle (trcd = 2, anw = 2, tpc = 1)
702 t r ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31 to d0 (read) d31 to d0 (write) cs2 or cs3 bs t c1 t c2 t c1 t c2 t c1 t c2 t c1 t c2 (t pc ) t ad row address t ad column address column address column address column address t wdh3 t wdh3 t csd1 t csd1 t rasd1 t rwh t rasd1 t casd1 t casd1 t casd1 t ah t rds1 t rdh1 t casd1 t rwd t ah t ad t ad t ad t as t as row address t rwd t rds1 t rdh1 t wdd2 t rwh t wdd2 t wdh1 dackn t dakd1 t dakd1 t bsd t bsd t wds t ah figure 23.24 dram burst bus cycle (trcd = 0, anw = 1, tpc = 0)
703 ckio rd/ wr d31 to d0 (write) d31 to d0 (write) ras casxx bs cs2 , cs3 a25 to a16 a15 to a0 t r t ad row address t ad t rwd t rwh t rdh1 t rdh1 t rds1 t ah t rwh t wdh3 t wdh1 t wdh3 t wdd2 t csd1 t dakd1 t bsd t bsd t csd1 t as t as t ad t c2 (t pc ) t rasd1 t cw t c1 t c2 t cw t c1 t rw t rw t ah t rwd t rasd1 t casd1 t rds1 t ad t ad t casd1 t casd1 column address column address row address dackn t dakd1 t wdd2 t wds t ah figure 23.25 dram burst bus cycle (trcd = 2, anw = 2, tpc = 0)
704 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs3 a25 to a16 t r t c1 t c2 (t pc ) t ad t ad t as t ad t rasd1 t ad t as t ah t rwd t ah a15 to a0 t rwh t rwd t rasd2 t casd1 t casd1 t wdh3 t wdh1 t rdh2 t rds2 t wdd2 t bsd t bsd t csd1 t csd1 t wds row address row address column address dackn t dakd1 t dakd1 figure 23.26 dram bus cycle (edo mode, trcd = 0, anw = 1, tpc = 0)
705 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs3 a25 to a16 a15 to a0 t r t rw t rw t c1 t cw t c2 (t pc ) (t pc ) t rwh t rwd row address t ad t ad t rwd t rasd1 t ah t ad t as t ad t ah t as t rasd2 t casd1 t wdh3 t wdh1 t wds t rds2 t rdh2 t casd1 t bsd t bsd t csd1 t csd1 row address column address t wdd2 dackn t dakd1 t dakd1 figure 23.27 dram bus cycle (edo mode, trcd = 2, anw = 2, tpc = 1)
706 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs3 dackn a25 to a16 a15 to a0 t r t ad t ad t ad t rwd t wdh3 t rds2 t rdh2 t wdh3 t csd1 t csd1 t as t as t ah t ah t ah t rwh t ad t ad t c2 (t pc ) t wdh1 t wdd2 t dakd1 t dakd1 t c1 t c2 t c1 t c2 t c1 t c2 t c1 t rwd t rasd1 t casd1 t casd1 t casd1 t casd1 t rasd2 t rdh2 t wdd2 t wds t rds2 t bsd t bsd row address row address column address column address column address column address figure 23.28 dram burst bus cycle (edo mode, trcd = 0, anw = 1, tpc = 0)
707 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs3 a25 to a16 a15 to a0 t r row address row address t c2 (t pc ) t cw t c1 t c2 t cw t c1 t rw t rw t ad t ad t ah t ah t rdh2 t wdh3 t wdd2 t wdh1 t wdh3 t rds2 t rwh t rwd t ah t ad t as t ad t ad t as t rwd t rasd1 t rasd2 t rdh2 t rds2 t casd1 t casd1 t wdd2 t wds t bsd t csd1 t csd1 t bsd t casd1 column address column address t dakd1 dackn t dakd1 figure 23.29 dram burst bus cycle (edo mode, trcd = 2, anw = 2, tpc = 0)
708 t rds3 t r t cs (t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31 to d0 (read) d31 to d0 (write) cs2 or cs3 dackn bs row address row address t rasd1 t casd3 t dakd1 t csd1 t csd1 t dakd1 t rasd2 t rwh t casd4 t rdh3 column address t rwd t rwd t ah t ah t ad t ad t ad t ad t as t as t wds t wdh1 t wdd2 t bsd t bsd figure 23.30 dram short-pitch access timing
709 t rds4 t rdh4 t r t cs (t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31 to d0 (read) d31 to d0 (write) cs3 dackn bs row address row address t casd3 t dakd1 t dakd1 t rasd1 t casd4 t csd1 t csd1 t rwh t rwd t rwd t ah t ah t ad t ad t ad t ad t as t as t wds t wdh1 t wdd2 t bsd t bsd t rasd1 column address figure 23.31 dram short-pitch access timing (edo mode)
710 t rc t rr1 t rrw t rr2 t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc ) ckio rd/ wr casxx cs2 or cs3 ras2 or ras figure 23.32 dram cas-before-ras refresh cycle (tras = 0, tpc = 0) t rc t rr1 t rrw t rrw t rrw t rrw t rr2 t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc )(t pc )(t pc ) ckio rd/ wr casxx cs2 or cs3 ras2 or ras figure 23.33 dram cas-before-ras refresh cycle (tras = 3, tpc = 2)
711 t rc t rr1 t rrw t sr1 t sr1 t sr2 (t pc ) t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc ) ckio rd/ wr casxx cs2 or cs3 ras2 or rasxx figure 23.34 dram self-refresh cycle (tpc = 0)
712 23.3.7 synchronous dram timing ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tr tad row address row address read a command row address column address tc1 tc2 (tpc) d31 to d0 tad tad tad tad tcsd1 trwd tcsd1 trwd trasd2 tdqmd tdqmd trdh2 tbsd tbsd (high) trds2 trasd2 tcasd2 tcasd2 tad tad tad 9*&d!  9*d9#  9*d9# figure 23.35 synchronous dram read bus cycle (rcd = 0, cas latency = 1, tpc = 0)
713 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke (high) a25 to a16 a15 to a0 tr trw trw tc1 tcw td1 (tpc) (tpc) 9#  9 $ 00
$ 00
$0 * command row address column address tad tad tad tad tcsd1 trwd tdqmd trdh2 tbsd tbsd trds2 tcsd1 trwd trasd2 tdqmd trasd2 tcasd2 tcasd2 tad tad tad tad dackn t dakd1 t dakd1 figure 23.36 synchronous dram read bus cycle (rcd = 2, cas latency = 2, tpc = 1)
714 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke (high) a25 to a16 a15 to a0 tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 (tpc) (tpc) 9#  9 $ 00
$ address read a command read command row address column address (1-4) tad tad tad tad tad tad tad tad tad tcsd1 tcsd1 trwd trwd trasd2 tdqmd tbsd tbsd trds2 trdh2 trds2 trdh2 tdqmd trasd2 tcasd2 tcasd2 t dakd1 t dakd1 dackn figure 23.37 synchronous dram read bus cycle (burst read (single read 4), rcd = 0, cas latency = 1, tpc = 1)
715 &d *#  *# $9 wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tr trw tc1 tc2 tc3 tc4/td1 td2 td3 td4 (tpc) 9#  9 (read) *9 *9 *9 *9 *9 *9 *9 *9 *9 *9 &/9# $j9 929 $9/ @/9 @/9 $9< $9/ $9< &/9# $j9 $*/9 $*/9 &*/9 929 &*/9 $ 00
$ address row address read command (high) column address (1-4) t dakd1 t dakd1 dackn figure 23.38 synchronous dram read bus cycle (burst read (single read 4), rcd = 1, cas latency = 3, tpc = 0)
716 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tr tc1 (trwl) (tpc) (high) d31 to d0 *9 $ 00
$ 00
j  * command row address column address tad tad tcsd1 trwd trasd2 tad tad tad tad tad tcsd1 trwd trwd trasd2 tcasd2 tdqmd twdd2 tbsd tdqmd twdh2 tbsd tcasd2 t dakd1 t dakd1 dackn figure 23.39 synchronous dram write bus cycle (rcd = 0, tpc = 0, trwl = 0)
717 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tr trw trw tc1 (trwl) (trwl) (tpc) (tpc) (high) d31 to d0 *9 $ 00
$ address write a command row address column address tad tad tad tad tad tad tcsd1 trwd trwd tad tad tad tcsd1 trwd trasd2 trasd2 tdqmd twdd2 tbsd tcasd2 tdqmd twdh2 tbsd tcasd2 t dakd1 t dakd1 dackn figure 23.40 synchronous dram write bus cycle (rcd = 2, tpc = 1, trwl = 1)
718 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tr tc1 tc2 tc3 tc4 (trwl) (tpc) (tpc) (high) d31 to d0 *9 $ 00
$ address write a command write command row address tad tad tad tad tcsd1 trwd trwd tad tad tad tad tcsd1 trwd trasd2 trasd2 tdqmd twdd2 twdd2 tbsd tcasd2 tdqmd twdh2 tbsd tcasd2 column address (1-4) t dakd1 t dakd1 dackn figure 23.41 synchronous dram write bus cycle (burst mode (single write 4), rcd = 0, tpc = 1, trwl = 0)
719 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke (high) a25 to a16 a15 to a0 tr trw tc1 tc2 tc3 td4 (trwl) (tpc) d31 to d0 row address row address write a command write command row address column address (1-4) tad tad tad tad tad tad tad tad tad tcsd1 tcsd1 trwd trwd trwd trasd2 tdqmd tbsd tbsd twdd2 twdd2 twdh2 tdqmd trasd2 tcasd2 tcasd2  9*d9#  9*d9# 9*&d! figure 23.42 synchronous dram write bus cycle (burst mode (single write 4), rcd = 1, tpc = 0, trwl = 0)
720 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tnop tc1 tc2/td1 tc3/td2 tc4/td3 td4 d31 to d0 t ad t ad t csd1 t csd1 t rwd t rwd t rasd2 t dqmd t dqmd t bsd t bsd (high) t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t casd2 t casd2 t ad row address read command column address t dakd1 t dakd1 dackn figure 23.43 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 1)
721 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tc1 tc2 tc3/td1 tc4/td2 td3 td4 d31 to d0 t ad t ad t csd1 t csd1 t rwd t rwd t rasd2 t dqmd t dqmd t bsd t bsd (high) t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t ad row address read command column address t casd2 t casd2 t dakd1 t dakd1 dackn figure 23.44 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 2)
722 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tp tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 d31 to d0 t ad t ad t csd1 t csd1 t rwd t rwd t rwd t rasd2 t rasd2 t dqmd t dqmd t dqmd t bsd t bsd t dakd1 t dakd1 (high) t ad t ad t ad t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t ad row address read command row address row address column address t casd2 t casd2 dackn figure 23.45 synchronous dram burst read bus cycle (ras down, different row address, tpc = 0, rcd = 0, cas latency = 1)
723 &d *#  *# $9 wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tp tpw tr tc1 tc2/td1 tc3/td2 tc4/td3 d31 to d0 t ad t ad t csd1 t csd1 t rwd t rwd t rwd t rasd2 t rasd2 t rasd2 t rasd2 t dqmd t dqmd t dqmd t bsd t bsd (high) t ad t ad t ad t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t ad td4 row address read command column address t casd2 t casd2 row address row address t dakd1 t dakd1 dackn figure 23.46 synchronous dram burst read bus cycle (ras down, different row address, tpc = 1, rcd = 0, cas latency = 1)
724 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tc1 tc2 tc3 tc4 d31 to d0 t ad t ad t csd1 t csd1 t rwd t rwd t rasd2 t rasd2 t dqmd t dqmd t wdd2 t wdd2 t bsd t bsd (high) t ad t ad t ad t casd2 t casd2 t ad row address write command column address t dakd1 t dakd1 dackn figure 23.47 synchronous dram burst write bus cycle (ras down, same row address)
725 t wdd2 t wdd2 ckio a12 or a10 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tp tr tc1 tc2 tc3 tc4 9#  9  *9  *9  &/9#  &/9#  $j9  $j9  $j9  $j9  $*/9  $*/9  929  929  929  @/9  @/9 <8<  *9  *9  *9  *9  *9  *9  *9 $ 00
j  --!0 $ address row address column address t casd2 t casd2 t dakd1 t dakd1 dackn figure 23.48 synchronous dram burst write bus cycle (ras down, different row address, tpc = 0, rcd = 0)
726 &d *#  *# $9 wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tp tpw tr trw tc1 tc2 tc3 d31 to d0 t ad t ad t csd1 t csd1 t rwd t rwd t rwd t rwd t rasd2 t rasd2 t rasd2 t rasd2 t dqmd t dqmd t dqmd t wdd2 t wdd2 t bsd t bsd (high) t ad t ad t ad t ad t ad t ad td4 write command column address t casd2 t casd2 row address row address t ad t ad $ 00
 9*d9#  9*d9# 9*&d! figure 23.49 synchronous dram burst write bus cycle (ras down, different row address, tpc = 1, rcd = 1)
727 ckio csn rd/ wr casxx cke ras3x tp tpc trr trrw trrw trrw (tpc) (tpc) t csd1 t csd1 t rasd2 t rasd2 t rasd2 t rasd2 t casd2 t casd2 t rwd t rwd figure 23.50 synchronous dram auto-refresh timing (tras = 1, tpc = 1)
728 tpc tra1 (trs2) (trs2) trs3 ckio cke csn ras3x casxx rd/ wr t rwd t rwd t casd2 t rasd2 t casd2 t csd1 t rasd2 tp t csd1 t rasd2 t rasd2 (tpc) (tpc) t cked t cked t rwd figure 23.51 synchronous dram self-refresh cycle (tpc = 0)
729 ckio a12 or a10 rd/ wr csn ras casxx d31 to d0 a13 or a11 a11 to a2 or a9 to a2 trp1 trp2 trp3 trp4 tmw1 tmw2 tmw3 tmw4 (high) cke *9 *9 *9 *9 *9 *9 *9 *9 *9 *9 *9 &/9# &/9# $j9 $j9 $j9 $*/9 $*/9 $*/9 $*/9 &*/9 &*/9  9*d9#  9*d9# 9*&d! figure 23.52 synchronous dram mode register write cycle
730 23.3.8 pcmcia timing t pcm1 t pcm2 ckio a25 to a0 cexx rd/ wr pccrd/ wr rd d15 to d0 we1 d15 to d0 bs dackn t ad t ad t csd1 t csd1 t rwd t rsd t rsd t rwd t dakd1 t dakd1 t wed t wdd1 t wed t rds1 t rdh1 t bsd t bsd t wdh4 t wdh1 (read) (read) (write) (write) figure 23.53 pcmcia memory bus cycle (ted = 0, teh = 0, no wait)
731 ckio t pcm0 t pcm0w t pcm1 t pcm1w t pcm1w t pcm2 t pcm2w a25 to a0 cexx pccrd/ wr rd/ wr rd (read) d15 to d0 (read) we1 (write) d15 to d0 (write) bs dackn wait t ad t csd1 t rwd t ad t csd1 t rwd t wdh4 t rsd t rsd t dakd1 t dakd1 t wed t wdd1 t wed t wdh1 t rdh1 t bsd t wts t wth t wts t wth t rds1 t bsd figure 23.54 pcmcia memory bus cycle (ted = 2, teh = 1, one wait, external wait, waitsel = 0)
732 ckio t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 a25 to a4 a3 to a0 cexx rd/ wr pccrd/ wr rd d15 to d0 bs dackn t ad t ad t csd1 t rwd t csd1 t rwd t ad t ad t ad t ad t dakd1 t rsd t rsd t rdh1 t rdh1 t rsd t rsd t bsd t bsd t bsd t bsd t rds1 t rds1 note: even though burst mode is set, write cycle operation is the same as in normal mode. (read) (read) t dakd1 figure 23.55 pcmcia memory bus cycle (burst read, ted = 0, teh = 0, no wait)
733 ckio t pcm0 t pcm1 t pcm1w t pcm1w t pcm1w t pcm2 t pcm1 t pcm1w t pcm2 t pcm2w a25 to a4 a3 to a0 cexx pccrd/ wr rd/ wr rd (read) d15 to d0 (read) bs dackn wait t ad t ad t csd1 t rwd t csd1 t dakd1 t rwd t ad t ad t ad t rsd t rsd t rsd t rsd t dakd1 t bsd t bsd t bsd t bsd t rds1 t rdh1 t rdh1 t rds1 t wts t wth t wts t wts t wth t wth note: even though burst mode is set, the write cycle operation is the same as in normal mode. figure 23.56 pcmcia memory bus cycle (burst read, ted = 1, teh = 1, two waits, burst pitch = 3, waitsel = 0)
734 t pci1 t pci2 ckio a25 to a0 cexx pccrd/ wr rd/ wr iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs dackn t ad t ad t csd1 t csd1 t rwd t icrsd t icrsd t rwd t dakd1 t dakd1 t icwsd t wdd1 t icwsd t rdh1 t rds1 t bsd t bsd t wdh1 t wdh4 figure 23.57 pcmcia i/o bus cycle (ted = 0, teh = 0, no wait)
735 ckio t pci0 t pci0w t pci1 t pci1w t pci1w t pci2 t pci2w a25 to a0 cexx pccrd/ wr rd/ wr iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs dackn wait iois16 t ad t csd1 t rwd t ad t csd1 t rwd t icrsd t icrsd t dakd1 t dakd1 t icwsd t wdd1 t icwsd t wdh1 t wdh4 t rdh1 t bsd t bsd t wts t wth t wts t wth t io16s t io16h t rds1 figure 23.58 pcmcia i/o bus cycle (ted = 2, teh = 1, one wait, external wait, waitsel = 0)
736 ckio t pci0 t pci1 t pci1w t pci2 t pci1 t pci1w t pci2 t pci2w a25 to a4 a0 cexx rd/ wr pccrd/ wr iciord d15 to d0 iciowr d15 to d0 bs wait iois16 dackn t ad t ad t csd1 t csd1 t rwd t rwd t wdd1 t wdh3 t wdh4 t bsd t bsd t ad t ad t icrsd t icrsd t icrsd t icrsd t icwsd t wts t wth t wth t io16s t io16h t ad t rds1 t csd1 t dakd1 t dakd1 t rds1 t icwsd t icwsd t icwsd t rdh1 t rdh1 t wdd2 t wdh1 t bsd t bsd t wts (read) (read) (write) (write) figure 23.59 pcmcia i/o bus cycle (ted = 1, teh = 1, one wait, bus sizing, waitsel = 0)
737 23.3.9 peripheral module signal timing table 23.8 peripheral module signal timing (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) C66 module item symbol min max unit figure tmu, timer input setup time t tclks 15 ns 23.60 rtc timer clock input setup time t tcks 15 23.61 timer clock edge specification t tckwh 1.5 tcyc pulse width both edge specification t tckwl 2.5 oscillation settling time t rosc 3 s 23.62 sci input clock asynchronization t scyc 4 tcyc 23.62, cycle clock synchronization 6 23.63 input clock rise time t sckr 1.5 23.62 input clock fall time t sckf 1.5 input clock pulse width t sckw 0.4 0.6 tscyc transmission data delay time t txd 100 ns 23.63 receive data setup time (clock synchronization) t rxs 100 receive data hold time (clock synchronization) t rxh 100 rts delay time t rtsd 100 cts setup time (clock synchronization) t ctss 100 cts hold time (clock synchronization) t ctsh 100 port output data delay time t portd 17 ns 23.64 input data setup time t ports1 15 input data hold time t porth1 8 input data setup time t ports2 17 input data hold time t porth2 10 dmac dreq setup time t dreq 8 ns 23.65 dreq hold time t dreqh 8 drak delay time t drakd 14 23.66
738 t tclks ckio tclk (input) figure 23.60 tclk input timing t tcks t tcks t tckwh t tckwl ckio tclk (input) figure 23.61 tclk clock input timing rtc crystal oscillator stable oscillation v cc v ccmin t rosc figure 23.62 oscillation settling time at rtc crystal oscillator power-on t sckw t sckr t sckf t scyc sck figure 23.63 sck input clock timing
739 t scyc t txd sck txd (data trans- missiion) rxd (data reception) t rxh t rxs t rtsd rts cts t ctsh t ctss figure 23.64 sci i/o timing in clock synchronous mode t ports1 ckio port 7 to 0 (read) (b:p clock ratio = 1:1) port 7 to 0 (write) t porth1 t ports2 port 7 to 0 (read) (b:p clock ratio = other than 1:1) t porth2 t portd figure 23.65 i/o port timing dreqn ckio t drqs t drqh figure 23.66 dreq input timing
740 drak0/1 ckio t drakd t drakd figure 23.67 drak output timing 23.3.10 h-udi-related pin timing table 23.9 h-udi-related pin timing (v cc q = 3.3 0.3v, v cc = 1.9/1.8 0.15, avcc = 3.3 0.3v, ta = C20 to 75 c) item symbol min max unit figure tck cycle time t tckcyc 50 ns figure 23.68 tck high pulse width t tckh 12 ns tck low pulse width t tckl 12 ns tck rise/fall time t tckf 4 ns trst setup time t trsts 12 ns figure 23.69 trst hold time t trsth 50 t cyc tdi setup time t tdis 10 ns figure 23.70 tdi hold time t tdih 10 ns tms setup time t tmss 10 ns tms hold time t tmsh 10 ns tdo delay time t tdod 16ns asemd0 setup time t asemdh 12 ns figure 23.71 asemd0 hold time t asemds 12 ns t tckl t tckf v il v il v ih v ih v il 1/2 vcoq 1/2 vcoq note: when clock is input from tck pin t tckf t tckh t tckcyc figure 23.68 tck input timing
741 resetp t trsts t trsth trst figure 23.69 trst input timing (reset hold) tck tdi tms t tdis t tmss t tdih t tckcyc t tmsh t tdod tdo figure 23.70 h-udi data transfer timing t asemdos t asemdoh resetp asemd0 figure 23.71 asemd0 input timing
742 23.3.11 a/d converter timing table 23.10 a/d converter timing (vccq = 3.3 0.3 v, vcc = 1.9/1.8 0.15 v, avcc = 3.3 0.3 v, ta = C20 to 75c) item symbol min typ max unit figure external trigger input pulse width t trgw 2 tcyc 23.72 external trigger input start delay time t trgs 50ns input sampling time (cks = 0) t spl 65 tcyc 23.73 (cks = 1) 32 a/d conversion start delay time (cks = 0) t d 10 17 tcyc (cks = 1) 6 9 a/d conversion time (cks = 0) t conv 259 266 tcyc (cks = 1) 131 134 tcyc: p cycle ck adtrg input adcr 1 state t trgw t trgs figure 23.72 external trigger input timing
743 p? write signal adf * 1 input sampling timing t d a/d conversion start delay t spl input sampling time t conv a/d conversion time notes: * 1 adcsr write cycle * 2 adcsr address address * 2 t d t spl t conv figure 23.73 a/d conversion timing
744 23.3.12 ac characteristics measurement conditions ? i/o signal reference level: 1.5 v (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v) ? input pulse level: vss to 3.0 v (where resetp , resetm , nmi, irq5 C irq0 , ckio, and md5Cmd0 are within vss to vcc) ? input rise and fall times: 1 ns i ol i oh c l v ref lsi output pin dut output notes: c l is the total value that includes the capacitance of measurement instruments, etc., and is set as follows for each pin. 30pf: ckio, ras , casxx , cs0 , cs2 C cs6 , ce2a , ce2b , back 50pf: all other pins i ol and i oh are the values shown in table 23.3. 1. 2. figure 23.74 output load circuit
745 23.3.13 delay time variation due to load capacitance a graph (reference data) of the variation in delay time when a load capacitance greater than that stipulated (30 pf) is connected to the sh7709a's pins is shown below. the graph shown in figure 23.75 should be taken into consideration in the design process if the stipulated capacitance is exceeded in connecting an external device. if the connected load capacitance exceeds the range shown in figure 23.75, the graph will not be a straight line. +3 +2 +1 +0 +0 +10 +20 +30 +40 +50 load capacitance [pf] delay time [ns] figure 23.75 load capacitance vs. delay time
746 23.4 a/d converter characteristics table 23.11 lists the a/d converter characteristics. table 23.11 a/d converter characteristics (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) item min typ max unit resolution 10 10 10 bits conversion time 8.86 s analog input capacitance 20 pf permissible signal-source (single- source) impedance 5 k ? nonlinearity error 3.0 lsb offset error 2.0 lsb full-scale error 2.0 lsb quantization error 0.5 lsb absolute accuracy 4.0 lsb 23.5 d/a converter characteristics table 23.12 lists the d/a converter characteristics. table 23.12 d/a converter characteristics (vccq = 3.3 0.3 v, vcc = 1.8 0.2 v, avcc = 3.3 0.3 v, ta = C20 to 75c) item min typ max unit test conditions resolution 888bits conversion time 10.0 s 20-pf capacitive load absolute accuracy 2.5 4.0 lsb 2-m ? resistance load
747 appendix a pin functions a.1 pin states table a.1 shows pin states during resets, power-down states, and the bus-released states. table a.1 pin states during resets, power-down states, and bus-released state reset power-down category pin power-on reset manual reset standby sleep bus released clock extal i iiii xtal o * 1 o * 1 o * 1 o * 1 o * 1 ckio io * 1 io * 1 io * 1 io * 1 io * 1 extal2 i iiii xtal2 o oooo cap1, cap2 system control resetp i iiii resetm i iiii breq i iii back o oool md[5:0] i iiii ca i iiii status[1:0]/ptj[7:6] o op * 3 op * 3 op * 3 op * 3 interrupt irq[3:0]/ irl[3:0] / pth[3:0] v * 8 iiii irq4/ pth[4] v * 8 iiii nmi i iiii irls[3:0] /ptf[3:0]/ pint[11:8] viizii mcs[7:0] /ptc[7:0]/ pint[7:0] vop * 3 zh * 11 k * 3 op * 3 zp * 3 tck/ptf[4]/pint[12] iv i iz i i tdi/ptf[5]/pint[13] iv i iz i i tms/ptf[6]/pint[14] iv i iz i i trst/ptf[7]/pint[15] iv i iz i i irqout o oooo
748 table a.1 pin states during resets, power-down states, and bus-released state (cont) reset power-down category pin power-on reset manual reset standby sleep bus released address bus a[25:0] z o zl * 10 oz data bus d[15:0] z i z io z d[23:16]/pta[7:0] z ip * 3 zk * 3 iop * 3 zp * 3 d[31:24]/ptb[7:0] z ip * 3 zk * 3 iop * 3 zp * 3 bus control cs0 / mcs[0] hozh * 11 oz cs[2:4] /ptk[0:2] h op * 3 zh * 11 k * 3 op * 3 zp * 3 cs5 / ce1a /ptk[3] h op * 3 zh * 11 k * 3 op * 3 zp * 3 cs6 / ce1b hozh * 11 oz bs /ptk[4] h op * 3 zh * 11 k * 3 op * 3 zp * 3 ras3l /ptj[0] h op * 3 zok * 4 op * 3 zop * 4 ras2l /ptj[1] h op * 3 zok * 4 op * 3 zop * 4 ras3u /pte[2] v op * 3 zok * 4 op * 3 zop * 4 ras2u /pte[1] v op * 3 zok * 4 op * 3 zop * 4 cas2l /pte[6] v op * 3 zok * 4 op * 3 zop * 4 cas2h /pte[3] v op * 3 zok * 4 op * 3 zop * 4 casll / casl /ptj[2] h op * 3 zok * 4 op * 3 zop * 4 caslh / casu /ptj[3] h op * 3 zok * 4 op * 3 zop * 4 cashl / ptj[4] h op * 3 zok * 4 op * 3 zop * 4 cashh / ptj[5] h op * 3 zok * 4 op * 3 zop * 4 we0 /dqmll h o zh * 11 oz we1 /dqmlu/ we hozh * 11 oz we2 /dqmul/ iciord / ptk[6] hop * 3 zh * 11 k * 3 op * 3 zp * 3 we3/dqmuu/ iciowr / ptk[7] hop * 3 zh * 11 k * 3 op * 3 zp * 3 rd/ wr hozh * 11 oz rd hozh * 11 oz cke/ptk[5] h op * 3 ok * 3 op * 3 op * 3 wait ziziz
749 table a.1 pin states during resets, power-down states, and bus-released state (cont) reset power-down category pin power-on reset manual reset standby sleep bus released dmac dreq0 /ptd[4] v zi * 7 zi i dack0/ptd[5] v op * 3 zk * 3 op * 3 op * 3 drak0/ptd[1] v op * 3 zh * 11 k * 3 op * 3 op * 3 dreq1 /ptd[6] v zi * 7 zi i dack1/ptd[7] v op * 3 zk * 3 op * 3 op * 3 drak1/ptd[0] v op * 3 zh * 11 k * 3 op * 3 op * 3 timer tclk/pth[7] v zp iop * 5 iop * 5 iop * 5 sci/ smart card without fifo rxd0/scpt[0] txd0/scpt[0] sck0/scpt[1] z z v zi * 7 zo * 7 zp * 3 z zk * 3 zk * 3 iz * 6 oz * 6 iop * 5 iz * 6 oz * 6 iop * 5 scif/irda rxd1/scpt[2] z zi * 7 ziz * 6 iz * 6 with fifo txd1/scpt[2] z zo * 7 zk * 3 oz * 6 oz * 6 sck1/scpt[3] v zp * 3 zk * 3 iop * 5 iop * 5 scif with fifo rxd2/scpt[4] z zi * 7 ziz * 6 iz * 6 txd2/scpt[4] z zo * 7 zk * 3 oz * 6 oz * 6 sck2/scpt[5] v zp * 3 zk * 3 iop * 5 iop * 5 rts2 /scpt[6] v op * 3 zk * 3 op * 3 op * 3 cts2 /irq5/scpt[7] v * 8 zi * 7 iii port audsync /pte[7] ov op * 3 ok * 3 op * 3 op * 3 ce2b /pte[5] v op * 3 zh * 11 k * 3 op * 3 zp * 3 ce2a /pte[4] v op * 3 zh * 11 k * 3 op * 3 zp * 3 tdo/pte[0] ov op * 3 ok * 3 op * 3 op * 3 iois16 /ptg[7] v i z i i ptg[5] v i z i i audck/pth[6] v i z i i adtrg /pth[5] v * 8 iizii wakeup /ptd[3] v op * 3 ok * 3 op * 3 zp * 3 resetout /ptd[2] o op * 3 zk * 3 op * 3 op * 3
750 table a.1 pin states during resets, power-down states, and bus-released state (cont) reset power-down category pin power-on reset manual reset standby sleep bus released port audata[3:0]/ptg[3:0] iv port i iz port i i ptg[4] v i z i i asebrkak /ptg[5] ov port oi port oz port oi port oi port asemd0 /ptg[6] i (asemd) i z i i analog an[5:0]/ptl[5:0] z zi * 7 zi i an[6:7]/da[1:0]/ ptl[6:7] zzi * 7 iio * 9 io * 9 i: input o: output h: high-level output l: low-level output z: high impedance p: input or output depending on register setting k: input pin is high impedance, output pin holds the state v: i/o buffer off, pullup mos on notes: * 1 depending on the clock mode (md2Cmd0 setting) * 2 z when the port function is used. * 3 k or p when the port function is used. * 4 k or p when the port function is used. z or o when the port function is not used depending on register setting. * 5 k or p when the port function is used. i or o when the port function is not used depending on register setting. * 6 depending on register setting * 7 i or o when the port function is used. * 8 input schmidt buffers and pullup mos of irq[5:0] and adtrg are on; other inputs are off. * 9 i when the port function is used. i or o when the port function is not used, depending on register setting. * 10 in the standby mode, z or l depending on register setting. * 11 in the standby mode, z or h depending on register setting.
751 a.2 pin specifications table a.2 shows the pin specifications. table a.2 pin specifications pin pin no. i/o function md5 197 i operating mode pin (endian mode) md4, md3 196, 195 i operating mode pin (area 0 bus width) md2 to md0 2, 1, 144 i operating mode pin (clock mode) ras3l /ptj[0] 106 i/o ras for area 3 lower 32 mb / i/o port ras2l /ptj[1] 107 i/o ras for area 2 lower 32 mb / i/o port ce2a /pte[4] 103 i/o pcmcia ce2a / i/o port ce2b /pte[5] 104 i/o pcmcia ce2b / i/o port rxd0/scpt[0] 171 i serial port 0 data input / input port rxd1/scpt[2] 172 i serial port 1 data input / input port rxd2/scpt[4] 174 i serial port 2 data input / input port txd0/scpt[0] 164 o serial port 0 data output / output port txd1/scpt[2] 166 o serial port 1 data output / output port txd2/scpt[4] 168 o serial port 2 data output / output port sck0/scpt[1] 165 i/o serial port 0 clock input/output / i/o port sck1/scpt[3] 167 i/o serial port 1 clock input/output / i/o port sck2/scpt[5] 169 i/o serial port 2 clock input/output / i/o port rts2 /scpt[6] 170 i/o serial port 2 transfer request / i/o port status1/ptj[7] 158 i/o processor state / i/o port status0/ptj[6] 157 i/o processor state / i/o port a25 to a0 86, 84, 82, 80, 78 to 72, 70, 68 to 60, 58, 56 to 53 o address bus d31 to d24/ ptb[7] to ptb[0] 13 to 18, 20, 22 i/o data bus / i/o port d23 to d16/ pta[7] to pta[0] 23 to 26, 28, 30 to 32 i/o data bus / i/o port d15 to d0 34, 36 to 44, 46, 48 to 52 i/o data bus
752 table a.2 pin specifications (cont) pin pin no. i/o function mcs[7:0] /ptc[7:0]/ pint[7:0] 177 to 180,185 to 188 i/o mask rom chip select 7-0 / i/o port / port interrupt request wakeup /ptd[3] 182 i/o wakeup / i/o port resetout / ptd[2] 184 i/o reset output / i/o port drak0/ptd[1] 189 i/o dma control pin / i/o port drak1/ptd[0] 190 i/o dma control pin / i/o port dreq0 /ptd[4] 191 i dma transfer request 0 / input port dreq1 /ptd[6] 192 i dma transfer request 1 / input port an[5:0]/ptl[5:0] 204 to 199 i analog input pin / input port an[7:6]/da[1:0]/ ptl[7:6] 207, 206 i/o analog i/o pin / input port cs6 / ce1b 102 o chip select 6 / pcmcia ce1b cs5 / ce1a / ptk[3] 101 i/o chip select 5 / pcmcia ce2b / i/o port cs4 /ptk[2] 100 i/o chip select 4 / i/o port cs3 /ptk[1] 99 i/o chip select 3 / i/o port cs2 /ptk[0] 98 i/o chip select 2 / i/o port cs0 / mcs0 96 o chip select 0 / mask rom chip select 0 bs /ptk[4] 87 i/o bus cycle start / i/o port cashh /ptj[5] 113 i/o d31Cd24 selection cas / i/o port cashl /ptj[4] 112 i/o d23Cd16 selection cas / i/o port caslh / casu / ptj[3] 110 i/o d15Cd8 selection cas / i/o port casll / casl /ptj[2] 108 i/o d7Cd0 selection cas / cas(sdram) / i/o port dack0/ptd[5] 114 i/o dma transfer strobe 0 / i/o port dack1/ptd[7] 115 i/o dma transfer strobe 1 / i/o port rd 88 o read strobe pin we0 / dqmll 89 o d7Cd0 select signal/ dqm(sdram) we1 /dqmlu/ we 90 o d15Cd8 select signal / dqm(sdram)/ pcmcia we signal we2 /dqmul/ iciord /ptk[6] 91 i/o d23Cd16 select signal / dqm(sdram) / pcmcia iord signal / i/o port
753 table a.2 pin specifications (cont) pin pin no. i/o function we3 /dqmuu/ iciowr /ptk[7] 92 i/o d31Cd24 select signal /dqm(sdram) / pcmcia iowr signal / i/o port rd/ wr 93 o read/write select signal audsync/ pte[7] 94 i/o aud synchronous i/o port cas2l /pte[6] 116 i/o cas for d7Cd0 (area 2 dram) / i/o port cas2h /pte[3] 117 i/o cas for d15Cd8 (area 2 dram) / i/o port ras3u /pte[2] 118 i/o ras for area 3 upper 32 mb/ i/o port ras2u /pte[1] 119 i/o ras for area 2 upper 32 mb / i/o port tdo/pte[0] 120 i/o test data output i/o port resetm 124 i manual reset input pth[5]/ adtrg 125 i input port / adc trigger request iois16/ptg[7] 126 i i/o for pc card / input port asmdo /ptg[6] 127 i ase mode / input port asebrkak / ptg[5] 128 i ase break accept / input port ptg[4] 129 i input port audata[3]/ ptg[3] 130 i aud data / input port audata[2]/ ptg[2] 131 i aud data / input port audata[1]/ ptg[1] 133 i aud data / input port audata[0]/ ptg[0] 135 i aud data / input port trst/ptf[7]/ pint[15] 136 i test reset / input port / port interrupt request trst/ptf[6]/ pint[14] 137 i test mode switch / input port / port interrupt request trst/ptf[5]/ pint[13] 138 i test data input / input port / port interrupt request trst/ptf[4]/ pint[12] 139 i test clock / input port / port interrupt request irls [3:0]/ ptf[3:0]/ pint[11:8] 140 to 143 i external interrupt request / input port / port interrupt request
754 table a.2 pin specifications (cont) pin pin no. i/o function audck/pth[6] 151 i aud clock / input port wait 123 i hardware wait request breq 122 i bus request back 121 o bus acknowledge irqout 160 o interrupt / refresh request output resetp 193 i power-on reset input nmi 7 i nonmaskable interrupt request irq[3:0]/ irl[3:0] / pth[3:0] 11 to 8 i external interrupt request / external interrupt source / input port irq4/ pth[4] 12 i external interrupt request / input port cts2 /irq5/ scpt[7] 176 i serial port 2 transfer enable / external interrupt request / input port tclk/pth[7] 159 i/o clock i/o (for tmu/rtc) / i/o port extal 156 i external clock / crystal oscillator pin xtal 155 o crystal oscillator pin cap1 146 external capacitance pin (for pll1) cap2 149 external capacitance pin (for pll2) ckio 162 i/o system clock i/o xtal2 4 o crystal oscillator pin (for on-chip rtc) extal2 5 i crystal oscillator pin (for on-chip rtc) cke/ptk[5] 105 i/o ck enable for sdram / i/o port ca 194 i setting hardware standby v cc q 21, 35, 47, 59, 71, 85, 97, 111, 163, 183 power supply power supply (3.3 v), i/o buffer v cc C rtc 3 power supply rtc oscillator power supply (1.8 v) v cc C pll 145, 150 power supply pll power supply (1.8 v) av cc 205 power supply analog power supply (3.3 v) v ss q 19, 33, 45, 57, 69, 83, 95, 109, 161, 181 power supply power supply (0 v), i/o buffer
755 table a.2 pin specifications (cont) pin pin no. i/o function v ss 27, 79, 132, 152, 153, 173 power supply internal power supply (0 v) vcc 29, 81, 134, 154, 175 power supply internal power supply (1.8 v) v ss C rtc 6 power supply rtc-oscillator power supply (0 v) v ss C pll 147, 148 power supply pll power supply (0 v) av ss 198, 208 power supply analog power supply (0 v) note: power must be supplied constantly to all power-supply pins. a.3 processing of unused pins ? when rtc is not used ? extal2: pull up to v cc (1.9/1.8 v) ? xtal2: leave unconnected ? v cc C rtc: power supply (1.9/1.8 v) ? v ss C rtc: power supply (0 v) ? when pll1 is not used ? cap1: leave unconnected ? v cc C pll1: power supply (1.9/1.8 v) ? v ss C pll1: power supply (0 v) ? when pll2 is not used ? cap2: leave unconnected ? v cc C pll2: power supply (1.9/1.8 v) ? v ss C pll2: power supply (0 v) ? when on-chip crystal oscillator is not used ? xtal: leave unconnected ? when extal terminal is not used ? extal: pull up to v cc q (3.3 v) ? when a/d converter is not used ? an[7:0]: leave unconnected ? av cc : power supply (3.3 v) ? av ss : power supply (0 v)
756 a.4 pin states in access to each address space table a.3 pin states (normal memory/little endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled rd r low low low low w high high high high rd/ wr r high high high high w low low low low bs enabled enabled enabled enabled ras3u /pte[2] high high high high ras3l /ptj[0] high high high high casll / casu /ptj[2] high high high high caslh / casl /ptj[3] high high high high cashl /ptj[4] high high high high cashh /ptj[5] high high high high cas2l /pte[6] high high high high cas2h /pte[3] high high high high we0 /dqmll r high high high high w low low high low we1 / we /dqmlu r high high high high w high high low low we2 / iciord /dqmul/ r high high high high ptk[6] w high high high high we3 / iciowr /dqmuu/ r high high high high ptk[7] w high high high high ce2a /pte[4] high high high high ce2b /pte[5] high high high high ras2u /pte[1] high high high high ras2l /ptj[1] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15 to d8 high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
757 table a.3 pin states (normal memory/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high ras3l /ptj[0] high high high high high high high casll / casu /ptj[2] high high high high high high high caslh / casl /ptj[3] high high high high high high high cashl /ptj[4] high high high high high high high cashh /ptj[5] high high high high high high high cas2l /pte[6] high high high high high high high cas2h /pte[3] high high high high high high high we0 /dqmll r high high high high high high high w low high high high low high low we1 / we /dqmlu r high high high high high high high w high low high high low high low we2 / iciord /dqmul/ r high high high high high high high ptk[6] w high high low high high low low we3 / iciowr /dqmuu/ r high high high high high high high ptk[7] w high high high low high low low ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
758 table a.3 pin states (normal memory/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: * 1 disabled when wcr2 register wait setting is 0. * 2 unused data pins should be switched to the port function, or pulled up or down.
759 table a.4 pin states (normal memory/big endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled rd r low low low low w high high high high rd/ wr r high high high high w low low low low bs enabled enabled enabled enabled ras3u /pte[2] high high high high ras3l /ptj[0] high high high high casll / casu /ptj[2] high high high high caslh / casl /ptj[3] high high high high cashl /ptj[4] high high high high cashh /ptj[5] high high high high cas2l /pte[6] high high high high cas2h /pte[3] high high high high we0 /dqmll r high high high high w low high low low we1 / we /dqmlu r high high high high w high low high low we2 / iciord /dqmul/ r high high high high ptk[6] w high high high high we3 / iciowr /dqmuu/ r high high high high ptk[7] w high high high high ce2a /pte[4] high high high high ce2b /pte[5] high high high high ras2u /pte[1] high high high high ras2l /ptj[1] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15 to d8 high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
760 table a.4 pin states (normal memory/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high ras3l /ptj[0] high high high high high high high casll / casu /ptj[2] high high high high high high high caslh / casl /ptj[3] high high high high high high high cashl /ptj[4] high high high high high high high cashh /ptj[5] high high high high high high high cas2l /pte[6] high high high high high high high cas2h /pte[3] high high high high high high high we0 /dqmll r high high high high high high high w high high high low high low low we1 / we /dqmlu r high high high high high high high w high high low high high low low we2 / iciord /dqmul/ r high high high high high high high ptk[6] w high low high high low high low we3 / iciowr /dqmuu/ r high high high high high high high ptk[7] w low high high high low high low ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
761 table a.4 pin states (normal memory/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: * 1 disabled when wcr2 register wait setting is 0. * 2 unused data pins should be switched to the port function, or pulled up or down.
762 table a.5 pin states (burst rom/little endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled rd r low low low low w rd/ wr r high high high high w bs enabled enabled enabled enabled ras3u /pte[2] high high high high ras3l /ptj[0] high high high high casll / casu /ptj[2] high high high high caslh / casl /ptj[3] high high high high cashl /ptj[4] high high high high cashh /ptj[5] high high high high cas2l /pte[6] high high high high cas2h /pte[3] high high high high we0 /dqmll r high high high high w we1 / we /dqmlu r high high high high w we2 / iciord /dqmul/ r high high high high ptk[6] w we3 / iciowr /dqmuu/ r high high high high ptk[7] w ce2a /pte[4] high high high high ce2b /pte[5] high high high high ras2u /pte[1] high high high high ras2l /ptj[1] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15 to d8 high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
763 table a.5 pin states (burst rom/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w rd/ wr r high high high high high high high w bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high ras3l /ptj[0] high high high high high high high casll / casu /ptj[2] high high high high high high high caslh / casl /ptj[3] high high high high high high high cashl /ptj[4] high high high high high high high cashh /ptj[5] high high high high high high high cas2l /pte[6] high high high high high high high cas2h /pte[3] high high high high high high high we0 /dqmll r high high high high high high high w we1 / we /dqmlu r high high high high high high high w we2 / iciord /dqmul/ r high high high high high high high ptk[6] w we3 / iciowr /dqmuu/ r high high high high high high high ptk[7] w ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
764 table a.5 pin states (burst rom/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: * 1 disabled when wcr2 register wait setting is 0. * 2 unused data pins should be switched to the port function, or pulled up or down.
765 table a.6 pin states (burst rom/big endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled rd r low low low low w rd/ wr r high high high high w bs enabled enabled enabled enabled ras3u /pte[2] high high high high ras3l /ptj[0] high high high high casll / casu /ptj[2] high high high high caslh / casl /ptj[3] high high high high cashl /ptj[4] high high high high cashh /ptj[5] high high high high cas2l /pte[6] high high high high cas2h /pte[3] high high high high we0 /dqmll r high high high high w we1 / we /dqmlu r high high high high w we2 / iciord /dqmul/ r high high high high ptk[6] w we3 / iciowr /d qm u u / r high high high high ptk[7] w ce2a /pte[4] high high high high ce2b /pte[5] high high high high ras2u /pte[1] high high high high ras2l /ptj[1] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15 to d8 high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
766 table a.6 pin states (burst rom/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w rd/ wr r high high high high high high high w bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high ras3l /ptj[0] high high high high high high high casll / casu /ptj[2] high high high high high high high caslh / casl /ptj[3] high high high high high high high cashl /ptj[4] high high high high high high high cashh /ptj[5] high high high high high high high cas2l /pte[6] high high high high high high high cas2h /pte[3] high high high high high high high we0 /dqmll r high high high high high high high w we1 / we /dqmlu r high high high high high high high w we2 / iciord /dqmul/ r high high high high high high high ptk[6] w we3 / iciowr /d qm u u / r high high high high high high high ptk[7] w ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
767 table a.6 pin states (burst rom/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: * 1 disabled when wcr2 register wait setting is 0. * 2 unused data pins should be switched to the port function, or pulled up or down.
768 table a.7 pin states (dram/little endian) 16-bit bus width (area 3) 16-bit bus width (area 2) pin byte access (address 2n) byte access (address 2n + 1) word/ longword access byte access (address 2n) byte access (address 2n + 1) word/ longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled rd r high high high high high high w high high high high high high rd/ wr r high high high high high high w low low low low low low bs enabled enabled enabled enabled enabled enabled ras3u /pte[2] high/low * 1 high/low * 1 high/low * 1 high high high ras3l /ptj[0] low/high * 1 low/high * 1 low/high * 1 high high high casll / casu /ptj[2] low high low high high high caslh / casl /ptj[3] high low low high high high cashl /ptj[4] high high high high high high cashh /ptj[5] high high high high high high cas2l /pte[6] high high high low high low cas2h /pte[3] high high high high low low we0 /dqmll r high high high high high high w high high high high high high we1 / we /dqmlu r high high high high high high w high high high high high high we2 / iciord /dqmul/ r high high high high high high ptk[6] w high high high high high high we3 / iciowr /d qm u u / r high high high high high high ptk[7] w high high high high high high ce2a /pte[4] high high high high high high ce2b /pte[5] high high high high high high ras2u /pte[1] high high high high/low * 1 high/low * 1 high/low * 1 ras2l /ptj[1] high high high low/high * 1 low/high * 1 low/high * 1 cke disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address d7 to d0 valid data invalid data valid data valid data invalid data valid data d15 to d8 invalid data valid data valid data invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2
769 table a.7 pin states (dram/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 ras3l /ptj[0] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 casll / casu /ptj[2] low high high high low high low caslh / casl /ptj[3] high low high high low high low cashl /ptj[4] high high low high high low low cashh /ptj[5] high high high low high low low cas2l /pte[6] high high high high high high high cas2h /pte[3] high high high high high high high we0 /dqmll r high high high high high high high w high high high high high high high we1 / we /dqmlu r high high high high high high high w high high high high high high high we2 / iciord /dqmul/ r high high high high high high high ptk[6] w high high high high high high high we3 / iciowr /d qm u u / r high high high high high high high ptk[7] w high high high high high high high ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
770 table a.7 pin states (dram/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: * 1 lower 32-mbyte access / upper 32-mbyte access. * 2 unused data pins should be switched to the port function, or pulled up or down.
771 table a.8 pin states (dram/big endian) 16-bit bus width (area 3) 16-bit bus width (area 2) pin byte access (address 2n) byte access (address 2n + 1) word/ longword access byte access (address 2n) byte access (address 2n + 1) word/ longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled rd r high high high high high high w high high high high high high rd/ wr r high high high high high high w low low low low low low bs enabled enabled enabled enabled enabled enabled ras3u /pte[2] high/low * 1 high/low * 1 high/low * 1 high high high ras3l /ptj[0] low/high * 1 low/high * 1 low/high * 1 high high high casll / casu /ptj[2] high low low high high high caslh / casl /ptj[3] low high low high high high cashl /ptj[4] high high high high high high cashh /ptj[5] high high high high high high cas2l /pte[6] high high high high low low cas2h /pte[3] high high high low high low we0 /dqmll r high high high high high high w high high high high high high we1 / we /dqmlu r high high high high high high w high high high high high high we2 / iciord /dqmul/ r high high high high high high ptk[6] w high high high high high high we3 / iciowr /d qm u u / r high high high high high high ptk[7] w high high high high high high ce2a /pte[4] high high high high high high ce2b /pte[5] high high high high high high ras2u /pte[1] high high high high/low * 1 high/low * 1 high/low * 1 ras2l /ptj[1] high high high low/high * 1 low/high * 1 low/high * 1 cke disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address d7 to d0 invalid data valid data valid data invalid data valid data valid data d15 to d8 valid data invalid data valid data valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2
772 table a.8 pin states (dram/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 ras3l /ptj[0] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 casll / casu /ptj[2] high high high low high low low caslh / casl /ptj[3] high high low high high low low cashl /ptj[4] high low high high low high low cashh /ptj[5] low high high high low high low cas2l /pte[6] high high high high high high high cas2h /pte[3] high high high high high high high we0 /dqmll r high high high high high high high w high high high high high high high we1 / we /dqmlu r high high high high high high high w high high high high high high high we2 / iciord /dqmul/ r high high high high high high high ptk[6] w high high high high high high high we3 / iciowr /d qm u u / r high high high high high high high ptk[7] w high high high high high high high ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
773 table a.8 pin states (dram/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: * 1 lower 32-mbyte access / upper 32-mbyte access. * 2 unused data pins should be switched to the port function, or pulled up or down.
774 table a.9 pin states (synchronous dram/little endian) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 ras3l /ptj[0] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 casll / casu /ptj[2] low low low low low low low caslh / casl /ptj[3] high high high high high high high cashl /ptj[4] high high high high high high high cashh /ptj[5] high high high high high high high cashl /pte[6] high high high high high high high cashh /pte[3] high high high high high high high dqmll/ we0 r low high high high low high low w low high high high low high low dqmlu/ we1 r high low high high low high low w high low high high low high low dqmul/ we2 / iciord r high high low high high low low w high high low high high low low dqmuu/ we3 / iciowr r high high high low high low low w high high high low high low low ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address command address command address command address command address command address command address command
775 table a.9 pin states (synchronous dram/little endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: * 1 lower 32-mbyte access / upper 32-mbyte access * 2 normally high. low in self-refreshing.
776 table a.10 pin states (synchronous dram/big endian) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 ras3l /ptj[0] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 casll / casu /ptj[2] low low low low low low low caslh / casl /ptj[3] high high high high high high high cashl /ptj[4] high high high high high high high cashh /ptj[5] high high high high high high high cashl /pte[6] high high high high high high high cashh /pte[3] high high high high high high high dqmll/ we0 r high high high low high low low w high high high low high low low dqmlu/ we1 r high high low high high low low w high high low high high low low dqmul/ we2 / iciord r high low high high low high low w high low high high low high low dqmuu/ we3 / iciowr r low high high high low high low w low high high high low high low ce2a /pte[4] high high high high high high high ce2b /pte[5] high high high high high high high ras2u /pte[1] high high high high high high high ras2l /ptj[1] high high high high high high high cke high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address command address command address command address command address command address command address command
777 table a.10 pin states (synchronous dram/big endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: * 1 lower 32-mbyte access/ upper 32-mbyte access * 2 normally high. low in self-refreshing.
778 table a.11 pin states (pcmcia/little endian) pcmcia memory interface (area 5) pcmcia/io interface (area 5) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled rd r low low low low high high high high w high high high high high high high high rd/ wr r high high high high high high high high w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high high ras3l /ptj[0] high high high high high high high high casll / casl /ptj[2] high high high high high high high high caslh / casu /ptj[3] high high high high high high high high cashl /ptj[4] high high high high high high high high cashh /ptj[5] high high high high high high high high cas2l /pte[6] high high high high high high high high cas2h /pte[3] high high high high high high high high we0 /dqmll r high high high high high high high high w high high high high high high high high we1 / we /dqmlu r high high high high high high high high w low low low low high high high high we2 / iciord / r high high high high low low low low dqmul/ptk[6] w high high high high high high high high we3 / iciowr / r high high high high high high high high dqmuu/ptk[7] w high high high high low low low low ce2a /pte[4] high high low low high high low low ce2b /pte[5] high high high high high high high high ras2u /pte[1] high high high high high high high high ras2l /ptj[1] high high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled enabled enabled
779 table a.11 pin states (pcmcia/little endian) (cont) pcmcia memory interface (area 5) pcmcia/io interface (area 5) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access a25 to a0 address address address address address address address address d7 to d0 valid data valid data invalid data valid data valid data valid data invalid data valid data d15 to d8 high-z * 2 invalid data valid data valid data high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2
780 table a.11 pin states (pcmcia/little endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n+1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled rd r low low low low high high high high w high high high high high high high high rd/ wr r high high high high high high high high w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high high ras3l /ptj[0] high high high high high high high high casll / casu /ptj[2] high high high high high high high high caslh / casl /ptj[3] high high high high high high high high cashl /ptj[4] high high high high high high high high cashh /ptj[5] high high high high high high high high cas2l /pte[6] high high high high high high high high cas2h /pte[3] high high high high high high high high we0 /dqmll r high high high high high high high high w high high high high high high high high we1 / we /dqmlu r high high high high high high high high w low low low low high high high high we2 / iciord /dqmul/ r high high high high low low low low ptk[6] w high high high high high high high high we3 / iciowr /dqmuu/ r high high high high high high high high ptk[7] w high high high high low low low low ce2a /pte[4] high high high high high high high high ce2b /pte[5] high high low low high high low low ras2u /pte[1] high high high high high high high high ras2l /ptj[1] high high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled enabled enabled a25 to a0 address address address address address address address address
781 table a.11 pin states (pcmcia/little endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n+1) word/ long- word access d7 to d0 valid data valid data invalid data valid data valid data valid data invalid data valid data d15 to d8 high-z * 2 invalid data valid data valid data high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 notes: * 1 disabled when wcr2 register wait setting is 0. * 2 unused data pins should be switched to the port function, or pulled up or down.
782 table a.12 pin states (pcmcia/big endian) pcmcia memory interface (area 5) pcmcia/io interface (area 5) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled rd r low low low low high high high high w high high high high high high high high rd/ wr r high high high high high high high high w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high high ras3l /ptj[0] high high high high high high high high casll / casu /ptj[2] high high high high high high high high caslh / casl /ptj[3] high high high high high high high high cashl /ptj[4] high high high high high high high high cashh /ptj[5] high high high high high high high high cas2l /pte[6] high high high high high high high high cas2h /pte[3] high high high high high high high high we0 /dqmll r high high high high high high high high w high high high high high high high high we1 / we /dqmlu r high high high high high high high high w low low low low high high high high we2 / iciord / r high high high high low low low low dqmul/ptk[6] w high high high high high high high high we3 / iciowr / r high high high high high high high high dqmuu/ptk[7] w high high low low low low low low ce2a /pte[4] high high low low high high low low ce2b /pte[5] high high high high high high high high ras2u /pte[1] high high high high high high high high ras2l /ptj[1] high high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 /ptg[7] disabled disabled disabled disabled disabled disabled disabled disabled
783 table a.12 pin states (pcmcia/big endian) (cont) pcmcia memory interface (area 5) pcmcia/io interface (area 5) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access a25 to a0 address address address address address address address address d7 to d0 valid data invalid data valid data valid data valid data invalid data valid data valid data d15 to d8 high-z * 2 valid data invalid data valid data high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2
784 table a.12 pin states (pcmcia/big endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n+1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled rd r low low low low high high high high w high high high high high high high high rd/ wr r high high high high high high high high w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled ras3u /pte[2] high high high high high high high high ras3l /ptj[0] high high high high high high high high casll / casu /ptj[2] high high high high high high high high caslh / casl /ptj[3] high high high high high high high high cashl /ptj[4] high high high high high high high high cashh /ptj[5] high high high high high high high high cas2l /pte[6] high high high high high high high high cas2h /pte[3] high high high high high high high high we0 /dqmll r high high high high high high high high w high high high high high high high high we1 / we /dqmlu r high high high high high high high high w low low low low high high high high we2 / iciord /dqmul/ r high high high high low low low low ptk[6] w high high high high high high high high we3 / iciowr /dqmuu/ r high high high high high high high high ptk[7] w high high high high low low low low ce2a * 3 /pte[4] high high high high high high high high ce2b * 3 /pte[5] high high low low high high low low ras2u /pte[1] high high high high high high high high ras2l /ptj[1] high high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 /ptg[7] disabled disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address address
785 table a.12 pin states (pcmcia/big endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n+1) word/ long- word access d7 to d0 valid data invalid data valid data valid data valid data invalid data invalid data valid data d15 to d8 high-z * 2 valid data invalid data valid data high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 notes: * 1 disabled when wcr2 register wait setting is 0. * 2 unused data pins should be switched to the port function, or pulled up or down. * 3 ce pin operation is the same as in little-endian mode.
786 appendix b memory-mapped control registers b.1 register address map table b.1 memory-mapped control registers control register module * 1 bus * 2 address * 4 size (bits) access size (bits) * 3 pteh ccn l h'fffffff0 32 32 ptel ccn l h'fffffff4 32 32 ttb ccn l h'fffffff8 32 32 tea ccn l h'fffffffc 32 32 mmucr ccn l h'ffffffe0 32 32 basra ccn l h'ffffffe4 8 8 basrb ccn l h'ffffffe8 8 8 ccr ccn l h'ffffffec 32 32 ccr2 ccn i h'040000b0 32 32 tra ccn l h'ffffffd0 32 32 expevt ccn l h'ffffffd4 32 32 intevt ccn l h'ffffffd8 32 32 bara ubc l h'ffffffb0 32 32 bamra ubc l h'ffffffb4 32 32 bbra ubc l h'ffffffb8 16 16 barb ubc l h'ffffffa0 32 32 bamrb ubc l h'ffffffa4 32 32 bbrb ubc l h'ffffffa8 16 16 bdrb ubc l h'ffffff90 32 32 bdmrb ubc l h'ffffff94 32 32 brcr ubc l h'ffffff98 32 32 frqcr cpg i h'ffffff80 16 16 stbcr cpg i h'ffffff82 8 8 stbcr2 cpg i h'ffffff88 8 8 wtcnt cpg i h'ffffff84 8 16 wtcsr cpg i h'ffffff86 8 16 bcr1 bsc i h'ffffff60 16 16 bcr2 bsc i h'ffffff62 16 16
787 table b.1 memory-mapped control registers (cont) control register module * 1 bus * 2 address * 4 size (bits) access size (bits) * 3 wcr1 bsc i h'ffffff64 16 16 wcr2 bsc i h'ffffff66 16 16 mcr bsc i h'ffffff68 16 16 dcr bsc i h'ffffff6a 16 16 pcr bsc i h'ffffff6c 16 16 rtcsr bsc i h'ffffff6e 16 16 rtcnt bsc i h'ffffff70 16 16 rtcor bsc i h'ffffff72 16 16 rfcr bsc i h'ffffff74 16 16 bcr3 bsc i h'ffffff7e 16 16 sdmr bsc i h'ffffd000 C h'ffffefff 8 mcscr0 bsc i h'ffffff50 16 16 mcscr1 bsc i h'ffffff52 16 16 mcscr2 bsc i h'ffffff54 16 16 mcscr3 bsc i h'ffffff56 16 16 mcscr4 bsc i h'ffffff58 16 16 mcscr5 bsc i h'ffffff5a 16 16 mcscr6 bsc i h'ffffff5c 16 16 mcscr7 bsc i h'ffffff5e 16 16 r64cnt rtc p h'fffffec0 8 8 rseccnt rtc p h'fffffec2 8 8 rmincnt rtc p h'fffffec4 8 8 rhrcnt rtc p h'fffffec6 8 8 rwkcnt rtc p h'fffffec8 8 8 rdaycnt rtc p h'fffffeca 8 8 rmoncnt rtc p h'fffffecc 8 8 ryrcnt rtc p h'fffffece 8 8 rsecar rtc p h'fffffed0 8 8 rminar rtc p h'fffffed2 8 8 rhrar rtc p h'fffffed4 8 8 rwkar rtc p h'fffffed6 8 8
788 table b.1 memory-mapped control registers (cont) control register module * 1 bus * 2 address * 4 size (bits) access size (bits) * 3 rdayar rtc p h'fffffed8 8 8 rmonar rtc p h'fffffeda 8 8 rcr1 rtc p h'fffffedc 8 8 rcr2 rtc p h'fffffede 8 8 icr0 intc i h'fffffee0 16 16 ipra intc i h'fffffee2 16 16 iprb intc i h'fffffee4 16 16 tocr tmu p h'fffffe90 8 8 tstr tmu p h'fffffe92 8 8 tcor0 tmu p h'fffffe94 32 32 tcnt0 tmu p h'fffffe98 32 32 tcr0 tmu p h'fffffe9c 16 16 tcor1 tmu p h'fffffea0 32 32 tcnt1 tmu p h'fffffea4 32 32 tcr1 tmu p h'fffffea8 16 16 tcor2 tmu p h'fffffeac 32 32 tcnt2 tmu p h'fffffeb0 32 32 tcr2 tmu p h'fffffeb4 16 16 tcpr2 tmu p h'fffffeb8 32 32 scsmr sci p h'fffffe80 8 8 scbrr sci p h'fffffe82 8 8 scscr sci p h'fffffe84 8 8 sctdr sci p h'fffffe86 8 8 scssr sci p h'fffffe88 8 8 scrdr sci p h'fffffe8a 8 8
789 table b.1 memory-mapped control registers (cont) control register module * 1 bus * 2 address * 4 size (bits) access size (bits) * 3 intevt2 intc i h'04000000 32 32 irr0 intc i h'04000004 16 8 irr1 intc i h'04000006 16 8 irr2 intc i h'04000008 16 8 icr1 intc i h'04000010 16 16 icr2 intc i h'04000012 16 16 inter intc i h'04000014 16 16 iprc intc i h'04000016 16 16 iprd intc i h'04000018 16 16 ipre intc i h'0400001a 16 16 sar0 dmac p h'04000020 32 16,32 dar0 dmac p h'04000024 32 16,32 dmatcr0 dmac p h'04000028 32 16,32 chcr0 dmac p h'0400002c 32 8,16,32 sar1 dmac p h'04000030 32 16,32 dar1 dmac p h'04000034 32 16,32 dmatcr1 dmac p h'04000038 32 16,32 chcr1 dmac p h'0400003c 32 8,16,32 sar2 dmac p h'04000040 32 16,32 dar2 dmac p h'04000044 32 16,32 dmatcr2 dmac p h'04000048 32 16,32 chcr2 dmac p h'0400004c 32 8,16,32 sar3 dmac p h'04000050 32 16,32 dar3 dmac p h'04000054 32 16,32 dmatcr3 dmac p h'04000058 32 16,32 chcr3 dmac p h'0400005c 32 8,16,32 dmaor dmac p h'04000060 16 8,16 cmstr cmt p h'04000070 16 8,16,32 cmcsr cmt p h'04000072 16 8,16,32
790 table b.1 memory-mapped control registers (cont) control register module * 1 bus * 2 address * 4 size (bits) access size (bits) * 3 cmcnt cmt p h'04000074 16 8,16,32 cmcor cmt p h'04000076 16 8,16,32 addrah a/d p h'04000080 8 8,16,32 * 5, * 6 addral a/d p h'04000082 8 8,16 * 5 addrbh a/d p h'04000084 8 8,16,32 * 5, * 6 addrbl a/d p h'04000086 8 8,16 * 5 addrch a/d p h'04000088 8 8,16,32 * 5, * 6 addrcl a/d p h'0400008a 8 8,16 * 5 addrdh a/d p h'0400008c 8 8,16,32 * 5, * 6 addrdl a/d p h'0400008e 8 8,16 * 5 adcsr a/d p h'04000090 8 8,16,32 * 5, * 6 adcr a/d p h'04000092 8 8,16 dadr0 d/a p h'040000a0 8 8,16,32 * 5, * 6 dadr1 d/a p h'040000a2 8 8,16 * 5 dacr d/a p h'040000a4 8 8,16,32 pacr port p h'04000100 16 16 pbcr port p h'04000102 16 16 pccr port p h'04000104 16 16 pdcr port p h'04000106 16 16 pecr port p h'04000108 16 16 pfcr port p h'0400010a 16 16 pgcr port p h'0400010c 16 16 phcr port p h'0400010e 16 16 pjcr port p h'04000110 16 16 pkcr port p h'04000112 16 16 plcr port p h'04000114 16 16 scpcr port p h'04000116 16 16 padr port p h'04000120 8 8 pbdr port p h'04000122 8 8 pcdr port p h'04000124 8 8
791 table b.1 memory-mapped control registers (cont) control register module * 1 bus * 2 address * 4 size (bits) access size (bits) * 3 pddr port p h'4000126 8 8 pedr port p h'4000128 8 8 pfdr port p h'400012a 8 8 pgdr port p h'400012c 8 8 phdr port p h'400012e 8 8 pjdr port p h'4000130 8 8 pkdr port p h'4000132 8 8 pldr port p h'4000134 8 8 scpdr port p h'4000136 8 8 scsmr1 irda p h'4000140 8 8 scbrr1 irda p h'4000142 8 8 scscr1 irda p h'4000144 8 8 scftdr1 irda p h'4000146 8 8 scssr1 irda p h'4000148 16 16 scfrdr1 irda p h'400014a 8 8 scfcr1 irda p h'400014c 8 8 scfdr1 irda p h'400014e 16 16 scsmr2 scif p h'4000150 8 8 scbrr2 scif p h'4000152 8 8 scscr2 scif p h'4000154 8 8 scftdr2 scif p h'4000156 8 8 scssr2 scif p h'4000158 16 16 scfrdr2 scif p h'400015a 8 8 scfcr2 scif p h'400015c 8 8 scfdr2 scif p h'400015e 16 16 sdir udi i h'4000200 16 16 notes: * 1 modules: ccn: cache controller ubc: user break controller cpg: clock pulse generator bsc: bus state controller rtc: realtime clock intc: interrupt controller tmu: timer unit sci: serial communication interface * 2 internal buses: l: cpu, ccn, cache, tlb, and dsp connected i: bsc, cache, dmac, intc, cpg, and h-udi connected
792 p: bsc and peripheral modules (rtc, tmu, sci, scif, irda, a/d, d/a, dmac, ports, cmt) connected * 3 the access size shown is for control register access (read/write). an incorrect result will be obtained if a different size from that shown is used for access. * 4 to exclude area 1 control registers from address translation by the mmu, set the first 3 bits of the logical address to 101, to locate the registers in the p2 space. * 5 with 16-bit access, it is not possible to read data in two registers simultaneously. * 6 with 32-bit access, it is not possible to read data in the register at [accessed address + 2] simultaneously.
793 b.2 register bits table b.2 register bits register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module sdmr bsc scsmr c/a chr pe o/e stop mp cks1 cks0 sci scbrr sci scscr tie rie te re mpie teie cke1 cke0 sci sctdr sci scssr tdre rdrf orer fer per tend mpb mpbt sci scrdr sci scscmr sdir sinv smif sci tocrtcoetmu tstr str2 str1 str0 tmu tcor0 tmu tcnt0 tmu tcr0 unftmu unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcor1 tmu tcnt1 tmu
794 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcr1 unftmu unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcor2 tmu tcnt2 tmu tcr2 icpf unf tmu icpe1 icpe0 unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcpr2 tmu r64cnt 1 hz 2 hz 4 hz 8 hz 16 hz 32 hz 64 hz rtc rseccnt 10 sec 1 sec rtc rmincnt 10 min 1 min rtc rhrcnt 10 hours 1 hour rtc rwkcnt day of week rtc rdaycnt 10 days 1 day rtc rmoncnt 10 months 1 month rtc ryrcnt 10 years 1 year rtc rsecar enb 10 sec 1 sec rtc rminar enb 10 min 1 min rtc rhrar enb 10 hours 1 hour rtc rwkar enb day of week rtc rdayar enb 10 days 1 day rtc rmonar enb 10 months 1 month rtc
795 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module rcr1 cf cie aie af rtc rcr2 pef pes2 pes1 pes0 rtcen adj reset start rtc icr0 nml nmie intc ipra tmu0 tmu1 intc tmu2 rtc iprb wdt ref intc sci bcr1 pula puld hizmem hizcnt endian a0bst1 a0bst0 a5bst1 bsc a5bst0 a6bst1 a6bst0 dramt p2 dramt p1 dramt p0 a5pcm a6pcm bcr2 a6sz1 a6sz0 a5sz1 a5sz0 a4sz1 a4sz0 bsc a3sz1 a3sz0 a2sz1 a2sz0 bcr3 extend tpc31 tpc30 rcd31 rcd30 tras31 tras30 bsc tpc21 tpc20 rcd21 rcd20 tras21 tras20 wcr1 waitsel a6iw1 a6iw0 a5iw1 a5iw0 a4iw1 a4iw0 bsc a3iw1 a3iw0 a2iw1 a2iw0 a0iw1 a0iw0 wcr2 a6w2 a6w1 a6w0 a5w2 a5w1 a5w0 a4w2 a4w1 bsc a4w0 a3w1 a3w0 a2w1 a2w0 a0w2 a0w1 a0w0 mcr tpc1 tpc0 rcd1 rcd0 trwl1 trwl0 tras1 tras0 bsc rasd be amx2 amx1 amx0 rfsh rmode edomo de dcr tpc1 tpc0 rcd1 rcd0 tras1 tras0 bsc be amx1 amx0 rfsh rmode pcr a6w3 a5w3 a5ted2 a6ted2 a5teh2 a6teh2 bsc a5ted1 a5ted0 a6ted1 a6ted0 a5teh1 a5teh0 a6teh1 a6teh0 rtcsr bsc cmf cmie cks2 cks1 cks0 ovf ovie lmts rtcnt bsc rtcor bsc
796 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module rfcr bsc frqcr stc2 ifc2 pfc2 slpfrq ckoen cpg pllen pstby stc1 stc0 ifc1 ifc0 pfc1 pfc0 stbcr stby mstp2 mstp1 mstp0 cpg stbcr2 mdchg mstp8 mstp7 mstp6 mstp5 mstp4 mstp3 cpg wtcnt cpg wtcsr tme wt/it rsts wovf iovf cks2 cks1 cks0 cpg bdrb ubc bdmrb ubc brcr ubc basma basmb scmfca scmfcb scmfda scmfdb pcte pcba dbeb pcbb seq etbe barb ubc bamrb basm bam bam ubc bbrb ubc ididrwrwszsz bara ubc
797 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module bamra basm bam bam ubc bbra ubc cda1 cda0 ida1 ida0 rwa1 rwa0 sza1 sza0 betr ubc brsr svf pid2 pid1 pid0 bsa27 bsa26 bsa25 bsa24 ubc bsa23 bsa22 bsa21 bsa20 bsa19 bsa18 bsa17 bsa16 bsa15 bsa14 bsa13 bsa12 bsa11 bsa10 bsa9 bsa8 bsa7 bsa6 bsa5 bsa4 bsa3 bsa2 bsa1 bsa0 brdr dvf bda27 bda26 bda25 bda24 ubc bda23 bda22 bda21 bda20 bda19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bda11 bda10 bda9 bda8 bda7 bda6 bda5 bda4 bda3 bda2 bda1 bda0 tra ccn expevt ccn intevt ccn mmucr ccn sv rc rc tf ix at
798 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module basra ubc basrb ubc ccr ccn ra 0 cf cb wt ce ccr2 ccn w3load w3lock w2load w2lock pteh ccn ptel ccn v prprsz c d sh ttb ccn tea ccn intevt2 intc
799 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module irr0 intc pint0r pint1r irq5r irq4r irq3r irq2r irq1r irq0r irr1 intc txi1r bri1r rxi1r eri1r dei3r dei2r dei1r dei0r irr2 intc adir txi2r bri2r rxi2r eri2r icr1 mai irqlvl blmsk irq51s irq50s irq41s irq40s intc irq31s irq30s irq21s irq20s irq11s irq10s irq01s irq00s icr2 int15s int14s int13s int12s int11s int10s int9s int8s intc int7s int6s int5s int4s int3s int2s int1s int0s inter int15e int14e int13e int12e int11e int10e int9e int8e intc int7e int6e int5e int4e int3e int2e int1e int0e iprc irq3s level irq2s level intc irq1s level irq0s level iprd pint0 to 7s level pint8 to 15s level intc irq5s level irq4s level ipre dmacs level irdas level intc scifs level a/ds level sar0 dmac dar0 dmac dmatcr0 dmac
800 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module chcr0 dmac diroamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 ds tm ts1 ts0 ie te de sar1 dmac dar1 dmac dmatcr1 dmac chcr1 dmac diroamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 ds tm ts1 ts0 ie te de sar2 dmac dar2 dmac
801 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module dmatcr2 dmac chcr2 dmac dirorlamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 ds tm ts1 ts0 ie te de sar3 dmac dar3 dmac dmatcr3 dmac chcr3 dmac dirorlamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 ds tm ts1 ts0 ie te de dmaor pr1pr0 dmac ae nmif dme cmstr cmt str cmcsr cmt cmf cks1 cks0
802 table b.2 registers bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module cmcnt cmt cmcor cmt addrah ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d addral ad1 ad0 a/d addrbh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d addrbl ad1 ad0 a/d addrch ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d addrcl ad1 ad0 a/d addrdh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d addrdl ad1 ad0 a/d adcsr adf ade adst scan cks ch2 ch1 ch0 a/d adcr trge a/d dadr0 d/a dadr1 d/a dacr daoe1 daoe0 dae d/a pacr pa7m d1 pa7m d0 pa6m d1 pa6m d0 pa5m d1 pa5m d0 pa4m d1 pa4m d0 port pa3m d1 pa3m d0 pa2m d1 pa2m d0 pa1m d1 pa1m d0 pa0m d1 pa0m d0 pbcr pb7m d1 pb7m d0 pb6m d1 pb6m d0 pb5m d1 pb5m d0 pb4m d1 pb4m d0 port pb3m d1 pb3m d0 pb2m d1 pb2m d0 pb1m d1 pb1m d0 pb0m d1 pb0m d0 pcdr pc7m d1 pc7m d0 pc6m d1 pc6m d0 pc5m d1 pc5m d0 pc4m d1 pc4m d0 port pc3m d1 pc3m d0 pc2m d1 pc2m d0 pc1m d1 pc1m d0 pc0m d1 pc0m d0 pdcr pd7m d1 pd7m d0 pd6m d1 pd6m d0 pd5m d1 pd5m d0 pd4m d1 pd4m d0 port
803 table b.2 register bits (cont) register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module pecr pe7m d1 pe7m d0 pe6m d1 pe6m d0 pe5m d1 pe5m d0 pe4m d1 pe4m d0 port pe3m d1 pe3m d0 pe2m d1 pe2m d0 pe1m d1 pe1m d0 pe0m d1 pe0m d0 pfcr pf7m d1 pf7m d0 pf6m d1 pf6m d0 pf5m d1 pf5m d0 pf4m d1 pf4m d0 port pf3m d1 pf3m d0 pf2m d1 pf2m d0 pf1m d1 pf1m d0 pf0m d1 pf0m d0 pgcr pg7m d1 pg7m d0 pg6m d1 pg6m d0 pg5m d1 pg5m d0 pg4m d1 pg4m d0 port pg3m d1 pg3m d0 pg2m d1 pg2m d0 pg1m d1 pg1m d0 pg0m d1 pg0m d0 phcr ph7m d1 ph7m d0 ph6m d1 ph6m d0 ph5m d1 ph5m d0 ph4m d1 ph4m d0 port ph3m d1 ph3m d0 ph2m d1 ph2m d0 ph1m d1 ph1m d0 ph0m d1 ph0m d0 pjcr pj7m d1 pj7m d0 pj6m d1 pj6m d0 pj5m d1 pj5m d0 pj4m d1 pj4m d0 port pj3m d1 pj3m d0 pj2m d1 pj2m d0 pj1m d1 pj1m d0 pj0m d1 pj0m d0 pkcr pk7m d1 pk7m d0 pk6m d1 pk6m d0 pk5m d1 pk5m d0 pk4m d1 pk4m d0 port pk3m d1 pk3m d0 pk2m d1 pk2m d0 pk1m d1 pk1m d0 pk0m d1 pk0m d0 plcr pl7m d1 pl7m d0 pl6m d1 pl6m d0 pl5m d1 pl5m d0 pl4m d1 pl4m d0 port pl3m d1 pl3m d0 pl2m d1 pl2m d0 pl1m d1 pl1m d0 pl0m d1 pl0m d0 scpcr scp7m d1 scp7m d0 scp6m d1 scp6m d0 scp5m d1 scp5m d0 scp4m d1 scp4m d0 port scp3m d1 scp3m d0 scp2m d1 scp2m d0 scp1m d1 scp1m d0 scp0m d1 scp0m d0 padr pa7dt pa6dt pa5dt pa4dt pa3dt pa2dt pa1dt pa0dt port pbdr pb7dt pb6dt pb5dt pb4dt pb3dt pb2dt pb1dt pb0dt port pcdr pc7dt pc6dt pc5dt pc4dt pc3dt pc2dt pc1dt pc0dt port pddr pd7dt pd6dt pd5dt pd4dt pd3dt pd2dt pd1dt pd0dt port
804 table b.2 register bits (cont) register bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 module pedr pe7dt pe6dt pe5dt pe4dt pe3dt pe2dt pe1dt pe0dt port pfdr pf7dt pf6dt pf5dt pf4dt pf3dt pf2dt pf1dt pf0dt port pgdr pg7dt pg6dt pg5dt pg4dt pg3dt pg2dt pg1dt pg0dt port phdr ph7dt ph6dt ph5dt ph4dt ph3dt ph2dt ph1dt ph0dt port pjdr pj7dt pj6dt pj5dt pj4dt pj3dt pj2dt pj1dt pj0dt port pkdr pk7dt pk6dt pk5dt pk4dt pk3dt pk2dt pk1dt pk0dt port pldr pl7dt pl6dt pl5dt pl4dt pl3dt pl2dt pl1dt pl0dt port scpdr scp7dt scp6dt scp5dt scp4dt scp3dt scp2dt scp1dt scp0dt port sdir ti3 ti2 ti1 ti0 udi sdsr pr3 pr2 pr1 pr0 vr3 vr2 vr1 vr0 udi asemw brkaf sdtrf sddr udi (sddrl) sdar ar9ar8udi ar7 ar6 ar5 ar4 ar3 ar2 sdare are9 are8 udi are7 are6 are5 are4 are3 are2
805 appendix c product lineup table c.1 sh7709a product lineup power supply voltage operating abbr. i/o internal frequency model marking package sh7709a 3.3 0.3 v 1.9 0.15 v 133 mhz hd6417709af133 208-pin plastic lqfp (fp-208c) HD6417709ABT133 216-pin tfbga (tbt-216b) 1.8 0.15 v 100 mhz hd6417709af100 208-pin plastic lqfp (fp-208c) hd6417709abt100 216-pin tfbga (tbt-216b)
806 appendix d package dimensions figures d.1 and d.2 show the sh7709a package dimensions. hitachi code jedec eiaj mass (reference value) fp-208c conforms 2.7 g * dimension including the plating thickness base material dimension 30.0 0.2 30.0 0.2 0.5 1.70 max 0 C 8 * 0.17 0.05 156 105 104 52 1 157 208 53 * 0.22 0.05 0.08 m 0.08 1.40 0.5 0.1 1.0 28 0.10 0.05 1.25 0.20 0.04 0.15 0.04 unit: mm figure d.1 package dimensions (fp-208c)
807 15.0 15.0 0.15 c a 0.15 c b 0.20 4 0.25 0.05 0.2 0.08 c c 1.00 max c c 0.05 ab m 216 0.30 0.05 details of the part a 0.50 0.50 0.50 a b 0.50 1 5 9 13 17 21 25 29 3 7 11 15 19 23 27 2 6 10 14 18 22 26 4 8 12 16 20 24 28 a b c d e f g h j k l m n p r t u v w y aa ab ac ad ae af ag ah aj a hitachi code jedec eiaj mass (reference value) tbt-216b 0.4 g unit: mm figure d.2 package dimensions (tbt-216b)
808
sh7709a hardware manual publication date: 1st edition, april 1999 5th edition, september 2001 published by: customer service division semiconductor & integrated circuits hitachi, ltd. edited by: technical documentation group hitachi kodaira semiconductor co., ltd. co py ri g ht ? hitachi, ltd., 1999. all ri g hts reserved. printed in ja p an.


▲Up To Search▲   

 
Price & Availability of HD6417709ABT133

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X